WattTime / pyiso

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

Error in pulling PJM forecast #104

Open MadDenker opened 7 years ago

MadDenker commented 7 years ago

I received the following error(s) when trying to pull PJM forecasts:

In [78]: pjm1.get_load(latest=True, forecast=True)
C:\Anaconda\lib\site-packages\requests\packages\urllib3\connectionpool.py:838: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/security.html
  InsecureRequestWarning)
Traceback (most recent call last):

  File "<ipython-input-78-e344816073a0>", line 1, in <module>
    pjm1.get_load(latest=True, forecast=True)

  File "C:\Anaconda\lib\site-packages\pyiso\pjm.py", line 151, in get_load
    df = self.fetch_edata_series('ForecastedLoadHistory', {'name': 'PJM RTO Total'})

  File "C:\Anaconda\lib\site-packages\pyiso\pjm.py", line 86, in fetch_edata_series
    dfs = pd.read_html(response.content, header=0, index_col=0)

  File "C:\Anaconda\lib\site-packages\pandas\io\html.py", line 896, in read_html
    keep_default_na=keep_default_na)

  File "C:\Anaconda\lib\site-packages\pandas\io\html.py", line 733, in _parse
    raise_with_traceback(retained)

  File "C:\Anaconda\lib\site-packages\pandas\io\html.py", line 727, in _parse
    tables = p.parse_tables()

  File "C:\Anaconda\lib\site-packages\pandas\io\html.py", line 196, in parse_tables
    tables = self._parse_tables(self._build_doc(), self.match, self.attrs)

  File "C:\Anaconda\lib\site-packages\pandas\io\html.py", line 451, in _build_doc
    from_encoding=self.encoding)

  File "C:\Anaconda\lib\site-packages\bs4\__init__.py", line 228, in __init__
    self._feed()

  File "C:\Anaconda\lib\site-packages\bs4\__init__.py", line 289, in _feed
    self.builder.feed(self.markup)

  File "C:\Anaconda\lib\site-packages\bs4\builder\_html5lib.py", line 68, in feed
    doc = parser.parse(markup, **extra_kwargs)

  File "C:\Anaconda\lib\site-packages\html5lib\html5parser.py", line 235, in parse
    self._parse(stream, False, None, *args, **kwargs)

  File "C:\Anaconda\lib\site-packages\html5lib\html5parser.py", line 85, in _parse
    self.tokenizer = _tokenizer.HTMLTokenizer(stream, parser=self, **kwargs)

  File "C:\Anaconda\lib\site-packages\html5lib\_tokenizer.py", line 36, in __init__
    self.stream = HTMLInputStream(stream, **kwargs)

  File "C:\Anaconda\lib\site-packages\html5lib\_inputstream.py", line 151, in HTMLInputStream
    return HTMLBinaryInputStream(source, **kwargs)

TypeError: __init__() got an unexpected keyword argument 'encoding'

It looks like our old friend bs4 and html5lib that pandas.io is using again...

Lucas

MadDenker commented 7 years ago

I'm trying this:

Pandas read_html Running Python 3.4 on a mac New pyvenv pip install pandas pip install lxml pip install html5lib pip install BeautifulSoup4 Then ran your example....

MadDenker commented 7 years ago

Actually, after restarting my kernel, that fixed it!

Can someone update the dependencies on the package?

marcparewatttime commented 7 years ago

Thanks, Lucas. I'll take a look at this sometime soon.