BUG: python 3 compression and read_fwf · Issue #3963 · pandas-dev/pandas (original) (raw)
Getting a TypeError: Type str doesn't support the buffer API
when using read_fwf
on a compressed file with python 3 only; works in python 2.7
Example:
with a file fwf.bug.txt
like
1111111111
2222222222
3333333333
4444444444
import pandas as pd
print(pd.version)
widths = [5, 5]
!gzip -d fwf_bug.txt
df = pd.read_fwf('fwf_bug.txt', widths=widths, names=['one', 'two']) print(df)
!gzip fwf_bug.txt
python 3 throws an error here.
df2 = pd.read_fwf('fwf_bug.txt.gz', widths=widths, names=['one', 'two'], compression='gzip')
print(df2)
Versions:
python3: 0.11.1.dev-4d06037
should be most recent
python2: 0.11.1.dev-3ebfef9
I can paste the full traceback if you'd like.