From 80bc86f677ba9d73ace78b1372da05c6b44b454b Mon Sep 17 00:00:00 2001 From: David Stephens Date: Mon, 10 Nov 2014 21:04:15 -0800 Subject: [PATCH] TST: Add additional RemoteDataError check to io.data.Options --- doc/source/whatsnew/v0.15.2.txt | 2 +- pandas/io/data.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/whatsnew/v0.15.2.txt b/doc/source/whatsnew/v0.15.2.txt index b1fa6dbed442d..fb0e4ecbf3119 100644 --- a/doc/source/whatsnew/v0.15.2.txt +++ b/doc/source/whatsnew/v0.15.2.txt @@ -44,5 +44,5 @@ Experimental Bug Fixes ~~~~~~~~~ - Bug in ``groupby`` signatures that didn't include *args or **kwargs (:issue:`8733`). -- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`). +- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo and when it receives no data from Yahoo (:issue:`8761`), (:issue:`8783`). - Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`) diff --git a/pandas/io/data.py b/pandas/io/data.py index d69343817a63f..0827d74191842 100644 --- a/pandas/io/data.py +++ b/pandas/io/data.py @@ -685,8 +685,14 @@ def _option_frames_from_url(self, url): except IndexError: self.underlying_price, self.quote_time = np.nan, np.nan - calls = self._process_data(frames[self._TABLE_LOC['calls']], 'call') - puts = self._process_data(frames[self._TABLE_LOC['puts']], 'put') + calls = frames[self._TABLE_LOC['calls']] + puts = frames[self._TABLE_LOC['puts']] + + if len(calls) == 0 or len(puts) == 0: + raise RemoteDataError('Received no data from Yahoo at url: %s' % url) + + calls = self._process_data(calls, 'call') + puts = self._process_data(puts, 'put') return {'calls': calls, 'puts': puts}