Skip to content

Commit 80bc86f

Browse files
TST: Add additional RemoteDataError check to io.data.Options
1 parent 81c8a5f commit 80bc86f

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

doc/source/whatsnew/v0.15.2.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ Experimental
4444
Bug Fixes
4545
~~~~~~~~~
4646
- Bug in ``groupby`` signatures that didn't include *args or **kwargs (:issue:`8733`).
47-
- ``io.data.Options`` now raises ``RemoteDataError`` when no expiry dates are available from Yahoo (:issue:`8761`).
47+
- ``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`).
4848
- Bug in slicing a multi-index with an empty list and at least one boolean indexer (:issue:`8781`)

pandas/io/data.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,14 @@ def _option_frames_from_url(self, url):
685685
except IndexError:
686686
self.underlying_price, self.quote_time = np.nan, np.nan
687687

688-
calls = self._process_data(frames[self._TABLE_LOC['calls']], 'call')
689-
puts = self._process_data(frames[self._TABLE_LOC['puts']], 'put')
688+
calls = frames[self._TABLE_LOC['calls']]
689+
puts = frames[self._TABLE_LOC['puts']]
690+
691+
if len(calls) == 0 or len(puts) == 0:
692+
raise RemoteDataError('Received no data from Yahoo at url: %s' % url)
693+
694+
calls = self._process_data(calls, 'call')
695+
puts = self._process_data(puts, 'put')
690696

691697
return {'calls': calls, 'puts': puts}
692698

0 commit comments

Comments
 (0)