|
30 | 30 | import pandas.core.common as com |
31 | 31 | from pandas.tools.merge import concat |
32 | 32 | from pandas import compat |
33 | | -from pandas.compat import u_safe as u, PY3, range, lrange |
| 33 | +from pandas.compat import u_safe as u, PY3, range, lrange, string_types |
34 | 34 | from pandas.io.common import PerformanceWarning |
35 | 35 | from pandas.core.config import get_option |
36 | 36 | from pandas.computation.pytables import Expr, maybe_expression |
@@ -273,7 +273,7 @@ def to_hdf(path_or_buf, key, value, mode=None, complevel=None, complib=None, |
273 | 273 | else: |
274 | 274 | f = lambda store: store.put(key, value, **kwargs) |
275 | 275 |
|
276 | | - if isinstance(path_or_buf, compat.string_types): |
| 276 | + if isinstance(path_or_buf, string_types): |
277 | 277 | with get_store(path_or_buf, mode=mode, complevel=complevel, |
278 | 278 | complib=complib) as store: |
279 | 279 | f(store) |
@@ -316,7 +316,7 @@ def read_hdf(path_or_buf, key, **kwargs): |
316 | 316 | f = lambda store, auto_close: store.select( |
317 | 317 | key, auto_close=auto_close, **kwargs) |
318 | 318 |
|
319 | | - if isinstance(path_or_buf, compat.string_types): |
| 319 | + if isinstance(path_or_buf, string_types): |
320 | 320 |
|
321 | 321 | # can't auto open/close if we are using an iterator |
322 | 322 | # so delegate to the iterator |
@@ -732,7 +732,7 @@ def select_as_multiple(self, keys, where=None, selector=None, columns=None, |
732 | 732 | where = _ensure_term(where) |
733 | 733 | if isinstance(keys, (list, tuple)) and len(keys) == 1: |
734 | 734 | keys = keys[0] |
735 | | - if isinstance(keys, compat.string_types): |
| 735 | + if isinstance(keys, string_types): |
736 | 736 | return self.select(key=keys, where=where, columns=columns, |
737 | 737 | start=start, stop=stop, iterator=iterator, |
738 | 738 | chunksize=chunksize, **kwargs) |
@@ -4168,7 +4168,7 @@ def _unconvert_string_array(data, nan_rep=None, encoding=None): |
4168 | 4168 | encoding = _ensure_encoding(encoding) |
4169 | 4169 | if encoding is not None and len(data): |
4170 | 4170 | try: |
4171 | | - data = data.astype(str).astype(object) |
| 4171 | + data = data.astype(string_types).astype(object) |
4172 | 4172 | except: |
4173 | 4173 | f = np.vectorize(lambda x: x.decode(encoding), otypes=[np.object]) |
4174 | 4174 | data = f(data) |
|
0 commit comments