Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dateTime heading error in usgs nwis class #11

Open
inkenbrandt opened this issue Jan 30, 2017 · 0 comments
Open

dateTime heading error in usgs nwis class #11

inkenbrandt opened this issue Jan 30, 2017 · 0 comments

Comments

@inkenbrandt
Copy link
Member

inkenbrandt commented Jan 30, 2017

---------------------------------------------------------------------------`
KeyError                                  Traceback (most recent call last)

<ipython-input-5-1abfc7093eba> in plotfits(HUC, SITE, fileloc)
     28 
     29     # Grab USGS data for comparison
---> 30     nw = wa.nwis('dv',SITE,'sites', startDT='2003-01-01')
     31     data = nw.data
     32     Label = nw.sites.station_nm[0].title()

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\wellapplication\usgs.pyc in __init__(self, service, values, loc_type, **kwargs)
     48         self.end_date = str(datetime.today().year) + '-' + str(datetime.today().month).zfill(2) + '-' + str(
     49             datetime.today().day).zfill(2)
---> 50         self.sites, self.data = self.get_nwis(**kwargs)
     51 
     52     @staticmethod

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\wellapplication\usgs.pyc in get_nwis(self, **kwargs)
    126 
    127             df = pd.DataFrame(dt[i]['values'][0]['value'])
--> 128             df.index = pd.to_datetime(df.pop('dateTime'))
    129             df.value = df.value.astype(float)
    130             df.index.name = 'datetime'

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\core\generic.pyc in pop(self, item)
    523         Return item and drop from frame. Raise KeyError if not found.
    524         """
--> 525         result = self[item]
    526         del self[item]
    527         try:

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\core\frame.pyc in __getitem__(self, key)
   2057             return self._getitem_multilevel(key)
   2058         else:
-> 2059             return self._getitem_column(key)
   2060 
   2061     def _getitem_column(self, key):

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\core\frame.pyc in _getitem_column(self, key)
   2064         # get column
   2065         if self.columns.is_unique:
-> 2066             return self._get_item_cache(key)
   2067 
   2068         # duplicate columns & possible reduce dimensionality

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\core\generic.pyc in _get_item_cache(self, item)
   1384         res = cache.get(item)
   1385         if res is None:
-> 1386             values = self._data.get(item)
   1387             res = self._box_item_values(item, values)
   1388             cache[item] = res

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\core\internals.pyc in get(self, item, fastpath)
   3539 
   3540             if not isnull(item):
-> 3541                 loc = self.items.get_loc(item)
   3542             else:
   3543                 indexer = np.arange(len(self.items))[isnull(self.items)]

c:\users\paulinkenbrandt\documents\github\env\lib\site-packages\pandas\indexes\base.pyc in get_loc(self, key, method, tolerance)
   2134                 return self._engine.get_loc(key)
   2135             except KeyError:
-> 2136                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2137 
   2138         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4443)()

pandas\index.pyx in pandas.index.IndexEngine.get_loc (pandas\index.c:4289)()

pandas\src\hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:13733)()

pandas\src\hashtable_class_helper.pxi in pandas.hashtable.PyObjectHashTable.get_item (pandas\hashtable.c:13687)()

KeyError: 'dateTime'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant