Skip to content

Commit

Permalink
ENH: Support bz2 compression in PY2 for c engine
Browse files Browse the repository at this point in the history
  • Loading branch information
dhimmel committed Dec 15, 2016
1 parent a7960f6 commit 85630ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pandas/parser.pyx
Expand Up @@ -621,8 +621,9 @@ cdef class TextReader:
if isinstance(source, basestring) or PY3:
source = bz2.BZ2File(source, 'rb')
else:
raise ValueError('Python 2 cannot read bz2 from open file '
'handle')
content = source.read()
source.close()
source = compat.StringIO(bz2.decompress(content))
elif self.compression == 'zip':
import zipfile
zip_file = zipfile.ZipFile(source)
Expand Down

0 comments on commit 85630ea

Please sign in to comment.