Skip to content

Commit 323cf72

Browse files
author
Tom Augspurger
committed
Merge pull request pandas-dev#9230 from jseabold/py3-s3
COMPAT: Need to read Bytes on Python
2 parents ff090f4 + 6805cc1 commit 323cf72

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

doc/source/whatsnew/v0.16.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Bug Fixes
8383

8484
.. _whatsnew_0160.bug_fixes:
8585

86+
- Fixed issue using `read_csv` on s3 with Python 3.
8687
- Fixed compatibility issue in ``DatetimeIndex`` affecting architectures where ``numpy.int_`` defaults to ``numpy.int32`` (:issue:`8943`)
8788
- Bug in Panel indexing with an object-like (:issue:`9140`)
8889

pandas/io/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import zipfile
66
from contextlib import contextmanager, closing
77

8-
from pandas.compat import StringIO, string_types
8+
from pandas.compat import StringIO, string_types, BytesIO
99
from pandas import compat
1010

1111

@@ -154,7 +154,7 @@ def get_filepath_or_buffer(filepath_or_buffer, encoding=None):
154154
b = conn.get_bucket(parsed_url.netloc)
155155
k = boto.s3.key.Key(b)
156156
k.key = parsed_url.path
157-
filepath_or_buffer = StringIO(k.get_contents_as_string())
157+
filepath_or_buffer = BytesIO(k.get_contents_as_string())
158158
return filepath_or_buffer, None
159159

160160

0 commit comments

Comments
 (0)