Skip to content

Commit c55511b

Browse files
author
y-p
committed
BUG: get_options_data should raise ValueError if given only one of month/year GH6105
1 parent 9ef3b9f commit c55511b

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

doc/source/release.rst

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ Bug Fixes
156156
- Subtle ``iloc`` indexing bug, surfaced in (:issue:`6059`)
157157
- Bug with insert of strings into DatetimeIndex (:issue:`5818`)
158158
- Fixed unicode bug in to_html/HTML repr (:issue:`6098`)
159+
- Fixed missing arg validation in get_options_data (:issue:`6105`)
159160

160161
pandas 0.13.0
161162
-------------

pandas/io/data.py

+4
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,10 @@ def get_options_data(self, month=None, year=None, expiry=None):
632632
_OPTIONS_BASE_URL = 'http://finance.yahoo.com/q/op?s={sym}'
633633

634634
def _get_option_data(self, month, year, expiry, table_loc, name):
635+
if (month is None or year is None) and expiry is None:
636+
msg = "You must specify either (`year` and `month`) or `expiry`."
637+
raise ValueError(msg)
638+
635639
year, month = self._try_parse_dates(year, month, expiry)
636640

637641
url = self._OPTIONS_BASE_URL.format(sym=self.symbol)

0 commit comments

Comments
 (0)