python - Read excel file from StringIO buffer to dataframe with pandas.io.parsers.ExcelFile? -
i'd read string buffer pandas dataframe. seems way use pandas' excelfile functionality. i've tried following:
from pandas import excelfile excel_handler excel_data = excel_handler(stringio(file_stream.read()).getvalue())
from on, guess excelfile.parse() can used.
this produces following error:
<class 'openpyxl.shared.exc.invalidfileexception'> [errno 2] no such file or directory: '
any ideas on how read in file buffer?
fixed. had missed part earlier in code file_stream.read() being called. consequently, time excelfile being called, empty string being passed it, causing error. getvalue() needed removed. here's how should go:
from pandas import excelfile excel_data = excelfile(stringio(file_stream.read()) dataframe = excel_data.parse(excel_data.sheet_names[-1])
Comments
Post a Comment