-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpandasprof.py
31 lines (24 loc) · 976 Bytes
/
pandasprof.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pandas as pd
import ydata_profiling
import streamlit as st
from streamlit_pandas_profiling import st_profile_report
import io
from io import StringIO
import os
def app(title=None):
st.set_page_config(layout="wide")
st.title(title)
# Add a file uploader for CSV files
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
# Add a select box for choosing the separator
sep = st.selectbox("Select the separator", ("Comma", "Tab", ";", ":"))
sep = "," if sep == "Comma" else "\t" if sep == "Tab" else ";" if sep == ";" else ":"
if uploaded_file is not None:
# Read the CSV data from the uploaded file
df = pd.read_csv(StringIO(uploaded_file.getvalue().decode('utf-8')), sep=sep)
pr = df.profile_report()
st.title("Dataframe:")
st.write(df)
st.title("Pandas Profiling:")
st_profile_report(pr)
app(title='Pandas Profiling in Streamlit')