|
3 | 3 | import numpy as np
|
4 | 4 |
|
5 | 5 | import requests
|
| 6 | +from io import StringIO |
6 | 7 |
|
7 |
| -import pandas.compat as compat |
8 | 8 | from pandas import DataFrame
|
9 | 9 | from pandas import read_csv, concat
|
10 | 10 | from pandas.io.common import urlencode
|
11 |
| -from pandas.compat import StringIO, bytes_to_str |
| 11 | +from pandas_datareader.compat import bytes_to_str, string_types, binary_type |
12 | 12 |
|
13 | 13 | from pandas_datareader._utils import (RemoteDataError, SymbolWarning,
|
14 | 14 | _sanitize_dates, _init_session)
|
@@ -99,7 +99,7 @@ def _read_url_as_StringIO(self, url, params=None):
|
99 | 99 | service = self.__class__.__name__
|
100 | 100 | raise IOError("{} request returned no data; check URL for invalid "
|
101 | 101 | "inputs: {}".format(service, self.url))
|
102 |
| - if isinstance(text, compat.binary_type): |
| 102 | + if isinstance(text, binary_type): |
103 | 103 | out.write(bytes_to_str(text))
|
104 | 104 | else:
|
105 | 105 | out.write(text)
|
@@ -205,7 +205,7 @@ def _get_params(self, *args, **kwargs):
|
205 | 205 | def read(self):
|
206 | 206 | """Read data"""
|
207 | 207 | # If a single symbol, (e.g., 'GOOG')
|
208 |
| - if isinstance(self.symbols, (compat.string_types, int)): |
| 208 | + if isinstance(self.symbols, (string_types, int)): |
209 | 209 | df = self._read_one_data(self.url,
|
210 | 210 | params=self._get_params(self.symbols))
|
211 | 211 | # Or multiple symbols, (e.g., ['GOOG', 'AAPL', 'MSFT'])
|
|
0 commit comments