I have a io.BytesIO
object, iostream
, which is a be2 file read from disk, and I am going to append column headers to the table/iostream
,
f = io.BytesIO()
f.write(b'A,B,C,D\n')
f.write(iostream.getvalue())
pd.read_table(f, sep=',', index_col=False, error_bad_lines=False, encoding='utf-8', dtype=type_map)
but it gave me an error,
pandas.errors.EmptyDataError: No columns to parse from file
I am wondering how to solve this issue.
Also tried
f = io.StringIO()
f.write('A,B,C,D\n')
f.write(iostream.getvalue().decode())
pd.read_table(f, sep=',', index_col=False, error_bad_lines=False, encoding='utf-8', dtype=type_map)
got error
pandas.errors.ParserError: Error tokenizing data. C error: Calling read(nbytes) on source failed. Try engine='python'.