Skip to content

Yahoo Finance Options tests raises ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y' #63

Closed
@femtotrader

Description

@femtotrader

Hello,

some Yahoo Finance Options tests raises

ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

I can see this exception using

$ nosetests -s -v

======================================================================
ERROR: test_get_all_data (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 358, in test_get_all_data
    data = self.aapl.get_all_data(put=True)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1197, in get_all_data
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_all_data_calls_only (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 372, in test_get_all_data_calls_only
    data = self.aapl.get_all_data(call=True, put=False)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1197, in get_all_data
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_call_data (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 337, in test_get_call_data
    calls = self.aapl.get_call_data(expiry=self.expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 901, in get_call_data
    expiry = self._try_parse_dates(year, month, expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1061, in _try_parse_dates
    expiry = [self._validate_expiry(expiry)]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1085, in _validate_expiry
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_data_with_list (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 365, in test_get_data_with_list
    data = self.aapl.get_call_data(expiry=self.aapl.expiry_dates)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_expiry_dates (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 351, in test_get_expiry_dates
    dates, _ = self.aapl._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_near_stock_price (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 330, in test_get_near_stock_price
    expiry=self.expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1005, in get_near_stock_price
    expiry = self._try_parse_dates(year, month, expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1061, in _try_parse_dates
    expiry = [self._validate_expiry(expiry)]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1085, in _validate_expiry
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_options_data (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 322, in test_get_options_data
    options = self.aapl.get_options_data(expiry=self.expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 750, in get_options_data
    self.get_call_data)]).sortlevel()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 749, in <listcomp>
    for f in (self.get_put_data,
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 964, in get_put_data
    expiry = self._try_parse_dates(year, month, expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1061, in _try_parse_dates
    expiry = [self._validate_expiry(expiry)]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1085, in _validate_expiry
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_put_data (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 344, in test_get_put_data
    puts = self.aapl.get_put_data(expiry=self.expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 964, in get_put_data
    expiry = self._try_parse_dates(year, month, expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1061, in _try_parse_dates
    expiry = [self._validate_expiry(expiry)]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1085, in _validate_expiry
    expiry_dates = self.expiry_dates
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_get_underlying_price (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 381, in test_get_underlying_price
    url = options_object._yahoo_url_from_expiry(options_object.expiry_dates[0])
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'September 18, 2015' does not match format '%B %d, %Y'

======================================================================
ERROR: test_month_year (test_data.TestYahooOptions)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1226, in expiry_dates
    expiry_dates = self._expiry_dates
AttributeError: 'Options' object has no attribute '_expiry_dates'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/tests/test_data.py", line 421, in test_month_year
    data = self.aapl.get_call_data(month=self.month, year=self.year)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 901, in get_call_data
    expiry = self._try_parse_dates(year, month, expiry)
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1075, in _try_parse_dates
    expiry = [expiry for expiry in self.expiry_dates if expiry.year == year and expiry.month == month]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1228, in expiry_dates
    expiry_dates, _ = self._get_expiry_dates_and_links()
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in _get_expiry_dates_and_links
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "/Users/femto/github/others/pandas-datareader/pandas_datareader/data.py", line 1250, in <listcomp>
    expiry_dates = [dt.datetime.strptime(element.text, "%B %d, %Y").date() for element in links]
  File "//anaconda/lib/python3.4/_strptime.py", line 500, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "//anaconda/lib/python3.4/_strptime.py", line 337, in _strptime
    (data_string, format))
ValueError: time data 'August 28, 2015' does not match format '%B %d, %Y'

but

$ nosetests -s -v pandas_datareader/tests/test_data.py:TestYahooOptions.test_get_all_data

don't raises any error !

Any idea ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions