Skip to content

Commit 85a0df6

Browse files
committed
Merge pull request #7530 from dstephens99/master
TST: io.data.Options changes to avoid test failures on bad data.
2 parents d60c46a + 2f81726 commit 85a0df6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pandas/io/data.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,10 @@ def _get_option_tables(self, month, year, expiry):
683683
table_name = '_tables' + m1 + str(year)[-2:]
684684
setattr(self, table_name, tables)
685685

686-
self.underlying_price, self.quote_time = self._get_underlying_price(root)
686+
try:
687+
self.underlying_price, self.quote_time = self._get_underlying_price(root)
688+
except IndexError:
689+
self.underlying_price, self.quote_time = np.nan, np.nan
687690

688691
return tables
689692

@@ -723,7 +726,7 @@ def _get_option_data(self, month, year, expiry, name):
723726
if ntables == 0:
724727
raise RemoteDataError("No tables found at {0!r}".format(url))
725728
elif table_loc - 1 > ntables:
726-
raise IndexError("Table location {0} invalid, {1} tables"
729+
raise RemoteDataError("Table location {0} invalid, {1} tables"
727730
" found".format(table_loc, ntables))
728731

729732
option_data = _parse_options_data(tables[table_loc])

0 commit comments

Comments
 (0)