It looks like you need to reset your buffer with text_io.seek(0)
after reading the csv into pandas.
def csv_test_input(df_train):
""" Function to take File based inputs for Network parameter """
uploaded_file = st.sidebar.file_uploader("Telecom Network Test-Data", type="csv")
if uploaded_file is None:
return None
text_io = io.TextIOWrapper(uploaded_file)
inputDF = pd.read_csv(text_io)
text_io.seek(0)
return inputDF
Previously we were creating a new buffer for you each time we reran. 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()
which will require a buffer reset.