Support multiple column delimiters

csv-delimiters
Clément FRÉVILLE 5 months ago
parent d4aeb87f75
commit c87308cc21

@ -1,5 +1,6 @@
import pandas as pd
import streamlit as st
import codecs
st.set_page_config(
page_title="Project Miner",
@ -9,10 +10,13 @@ st.set_page_config(
st.title("Home")
### Exploration
uploaded_file = st.file_uploader("Upload your CSV file", type=["csv"])
uploaded_file = st.file_uploader("Upload your CSV file", type=["csv", "tsv"])
separator = st.selectbox("Separator", [",", ";", "\\t"])
separator = codecs.getdecoder("unicode_escape")(separator)[0]
has_header = st.checkbox("Has header", value=True)
if uploaded_file is not None:
st.session_state.data = pd.read_csv(uploaded_file)
st.session_state.data = pd.read_csv(uploaded_file, sep=separator, header=0 if has_header else 1)
st.session_state.original_data = st.session_state.data
st.success("File loaded successfully!")

Loading…
Cancel
Save