File size: 1,094 Bytes
292e395
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c22dcd0
 
292e395
c22dcd0
 
 
 
 
 
 
 
 
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
32
33
34

import streamlit as st
import pandas as pd
import plotly.express as px
import cx_Oracle as ora
import pandas as pd
from pandas_profiling import ProfileReport

st.title("File Upload and Profiling")

# Upload a CSV dataset
uploaded_file = st.file_uploader("Upload your dataset", type=["csv"])
if uploaded_file is not None:
    # Load the dataset and display the first 5 rows
    df = pd.read_csv(uploaded_file)
    st.dataframe(df.head())

    # Generate a treemap or sunburst plot based on data types
    numerical_cols = df.select_dtypes(include=["float", "int"]).columns
    categorical_cols = df.select_dtypes(include=["object"]).columns

    fig = px.treemap(df, path=categorical_cols)
    st.plotly_chart(fig)
        
    # if len(numerical_cols) >= 2:
    #     fig = px.scatter_matrix(df, dimensions=numerical_cols)
    #     st.plotly_chart(fig)
    # elif len(categorical_cols) >= 2:
    #     fig = px.treemap(df, path=categorical_cols)
    #     st.plotly_chart(fig)
    # else:
    #     fig = px.sunburst(df, path=categorical_cols + numerical_cols)
    #     st.plotly_chart(fig)