GClunies/py_noaa

Column names are not descriptive, data not numeric, for requests < 31 days

GClunies opened this issue · 0 comments

Any request less than 31 days do not return a pandas dataframe with descriptive column names and all of the columns are still "non-null object', not numeric data. Example request less than 31 days:

In [12]: df_obs_less_than_31day = coops.get_data(begin_date="20121215", end_date="20121217", stationid="9447130", product="water_level", datum="mllw", units="english", time_z
    ...: one="lst_ldt")

In [13]: df_obs_less_than_31day.head()
Out[13]:
         f  q      s                 t       v
0  0,0,0,0  v  0.016  2012-12-15 00:00  -2.863
1  0,0,0,0  v  0.020  2012-12-15 00:06  -2.774
2  0,0,0,0  v  0.026  2012-12-15 00:12  -2.610
3  0,0,0,0  v  0.039  2012-12-15 00:18  -2.459
4  0,0,0,0  v  0.046  2012-12-15 00:24  -2.288

In [14]: df_obs_less_than_31day.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 720 entries, 0 to 719
Data columns (total 5 columns):
f    720 non-null object
q    720 non-null object
s    720 non-null object
t    720 non-null object
v    720 non-null object
dtypes: object(5)
memory usage: 28.2+ KB

Similar request bigger than 31 days results in:

In [4]: df_obs_more_than_31days = coops.get_data(begin_date="20121115", end_date="20121217", stationid="9447130", product="water_level", datum="mllw", units="english", time_z
   ...: one="lst_ldt")

In [5]: df_obs_more_than_31days.head()
Out[5]:
     flags  QC  sigma           date_time  water_level
0  0,0,0,0 NaN  0.062 2012-11-15 00:00:00       -2.429
1  0,0,0,0 NaN  0.043 2012-11-15 00:06:00       -2.206
2  0,0,0,0 NaN  0.033 2012-11-15 00:12:00       -1.996
3  0,0,0,0 NaN  0.043 2012-11-15 00:18:00       -1.793
4  0,0,0,0 NaN  0.039 2012-11-15 00:24:00       -1.537

In [6]: df_obs_more_than_31days.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 8160 entries, 0 to 479
Data columns (total 5 columns):
flags          8160 non-null object
QC             0 non-null float64
sigma          8155 non-null float64
date_time      8160 non-null datetime64[ns]
water_level    8160 non-null float64
dtypes: datetime64[ns](1), float64(3), object(1)
memory usage: 382.5+ KB

Output format should be consistent regardless of request length.