WattTime / pyiso

Python client libraries for ISO and other power grid data sources.
http://pyiso.readthedocs.org/
Other
238 stars 110 forks source link

get_generation() has issue with parameters #24

Closed mbonvini closed 9 years ago

mbonvini commented 9 years ago

Hi

when running the following script

from datetime import datetime
from pyiso import caiso
ca = caiso.CAISOClient()
ca.get_generation(start_at = datetime(2015,1,1), end_at = datetime(2015,1,4))

I get an error similar to #23

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-13-e26d8b8a16f3> in <module>()
----> 1 ca.get_generation(start_at = datetime(2015,1,1), end_at = datetime(2015,1,4))

/usr/local/lib/python2.7/dist-packages/pyiso/caiso.pyc in get_generation(self, latest, yesterday, start_at, end_at, **kwargs)
     79             return self._generation_forecast()
     80         else:
---> 81             return self._generation_historical()
     82 
     83     def get_load(self, latest=False,

/usr/local/lib/python2.7/dist-packages/pyiso/caiso.pyc in _generation_historical(self)
    384 
    385                 # combine date with hours to index
--> 386                 indexed = self.set_dt_index(df, this_date, df['Hour'])
    387 
    388                 # original header is fuel names

/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc in __getitem__(self, key)
   1789             return self._getitem_multilevel(key)
   1790         else:
-> 1791             return self._getitem_column(key)
   1792 
   1793     def _getitem_column(self, key):

/usr/local/lib/python2.7/dist-packages/pandas/core/frame.pyc in _getitem_column(self, key)
   1796         # get column
   1797         if self.columns.is_unique:
-> 1798             return self._get_item_cache(key)
   1799 
   1800         # duplicate columns & possible reduce dimensionaility

/usr/local/lib/python2.7/dist-packages/pandas/core/generic.pyc in _get_item_cache(self, item)
   1082         res = cache.get(item)
   1083         if res is None:
-> 1084             values = self._data.get(item)
   1085             res = self._box_item_values(item, values)
   1086             cache[item] = res

/usr/local/lib/python2.7/dist-packages/pandas/core/internals.pyc in get(self, item, fastpath)
   2849 
   2850             if not isnull(item):
-> 2851                 loc = self.items.get_loc(item)
   2852             else:
   2853                 indexer = np.arange(len(self.items))[isnull(self.items)]

/usr/local/lib/python2.7/dist-packages/pandas/core/index.pyc in get_loc(self, key, method)
   1576         """
   1577         if method is None:
-> 1578             return self._engine.get_loc(_values_from_object(key))
   1579 
   1580         indexer = self.get_indexer([key], method=method)

/usr/local/lib/python2.7/dist-packages/pandas/index.so in pandas.index.IndexEngine.get_loc (pandas/index.c:3824)()

/usr/local/lib/python2.7/dist-packages/pandas/index.so in pandas.index.IndexEngine.get_loc (pandas/index.c:3704)()

/usr/local/lib/python2.7/dist-packages/pandas/hashtable.so in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12349)()

/usr/local/lib/python2.7/dist-packages/pandas/hashtable.so in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:12300)()

KeyError: 'Hour'
aschn commented 9 years ago

This issue is resolved in release 0.1.19