Hopefully I’m getting your use case right but I think you should be able to do just this. The key here is the seek(0).
To optimize, we are returning the same buffer on rerun. Unfortunately, this means that if you’ve already read the buffer, you’ll need to reset after. If you use .getValue()
, there’s no need to seek
. Unfortunately for file uploader pandas.read_csv
does a read()
instead.
multiple_files = st.file_uploader('CSV',type="csv", accept_multiple_files=True)
for file in multiple_files:
dataframe = pd.read_csv(file)
file.seek(0)
st.write(dataframe)