I'm trying to create pandas dataframe from uploaded csv file without saving file. When I do df = pd.read_csv(request.file['file'])
pandas read this as a file but EmptyDataError: No columns to parse from file
is shown. But this file is loaded properly to dataframe from console. request.file['file'].stream
doesn't work also.
If you are receiving your csv
as a string try it using StringIO:
from io import StringIO
pd.read_csv(StringIO(request.file['file']))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With