Skip to content
Anna Schneider edited this page May 29, 2015 · 1 revision

Your mission, if you choose to accept it...

  1. Check out these docs to learn more about the data sources and the library: http://pyiso.readthedocs.org/

  2. Fork the repo: https://github.com/WattTime/pyiso

  3. Clone the repo

  4. Install the requirements: pip install -r requirements.txt . This will install several libraries including pandas, so if you don't want to risk messing up an existing pandas installation, you may wish to do this in a virtual environment.

  5. Run all the tests: python setup.py test. You should see several tests fail, including these:

======================================================================
ERROR: test_caiso_date_range (tests.test_genmix.TestCAISOGenMix)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/anna/github/pyisotmp/tests/test_genmix.py", line 207, in test_caiso_date_range
    end_at=today-timedelta(days=2), market=self.MARKET_CHOICES.hourly)
  File "/Users/anna/github/pyisotmp/tests/test_genmix.py", line 33, in _run_test
    data = c.get_generation(**kwargs)
  File "/Users/anna/github/pyisotmp/pyiso/caiso.py", line 81, in get_generation
    return self._generation_historical()
  File "/Users/anna/github/pyisotmp/pyiso/caiso.py", line 386, in _generation_historical
    indexed = self.set_dt_index(df, this_date, df['Hour'])
  File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1678, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1685, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 1052, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/internals.py", line 2565, in get
    loc = self.items.get_loc(item)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/index.py", line 1181, in get_loc
    return self._engine.get_loc(_values_from_object(key))
  File "index.pyx", line 129, in pandas.index.IndexEngine.get_loc (pandas/index.c:3656)
  File "index.pyx", line 149, in pandas.index.IndexEngine.get_loc (pandas/index.c:3534)
  File "hashtable.pyx", line 696, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11911)
  File "hashtable.pyx", line 704, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11864)
KeyError: 'Hour'

======================================================================
ERROR: test_caiso_yesterday (tests.test_genmix.TestCAISOGenMix)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/anna/github/pyisotmp/tests/test_genmix.py", line 227, in test_caiso_yesterday
    data = self._run_test('CAISO', yesterday=True, market=self.MARKET_CHOICES.hourly)
  File "/Users/anna/github/pyisotmp/tests/test_genmix.py", line 33, in _run_test
    data = c.get_generation(**kwargs)
  File "/Users/anna/github/pyisotmp/pyiso/caiso.py", line 81, in get_generation
    return self._generation_historical()
  File "/Users/anna/github/pyisotmp/pyiso/caiso.py", line 386, in _generation_historical
    indexed = self.set_dt_index(df, this_date, df['Hour'])
  File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1678, in __getitem__
    return self._getitem_column(key)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/frame.py", line 1685, in _getitem_column
    return self._get_item_cache(key)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/generic.py", line 1052, in _get_item_cache
    values = self._data.get(item)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/internals.py", line 2565, in get
    loc = self.items.get_loc(item)
  File "/usr/local/lib/python2.7/site-packages/pandas/core/index.py", line 1181, in get_loc
    return self._engine.get_loc(_values_from_object(key))
  File "index.pyx", line 129, in pandas.index.IndexEngine.get_loc (pandas/index.c:3656)
  File "index.pyx", line 149, in pandas.index.IndexEngine.get_loc (pandas/index.c:3534)
  File "hashtable.pyx", line 696, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11911)
  File "hashtable.pyx", line 704, in pandas.hashtable.PyObjectHashTable.get_item (pandas/hashtable.c:11864)
KeyError: 'Hour'
  1. Run just the test case class with those failing tests: python setup.py test -s tests.test_genmix.TestCAISOGenMix

  2. Make these two tests pass by diagnosing and fixing the bug! Feel free to write more tests--you'll probably want to add them to the file with the failing tests (tests/test_genmix.py) and/or the file with the rest of the CAISO tests (tests/test_caiso.py). You're also welcome to refactor, but that's certainly not required.

  3. Push your fix back to github.

  4. Send Anna an email with a link to your github fork and an explanation of your solution.

Clone this wiki locally