Spaces:
Sleeping
Sleeping
File size: 983 Bytes
dc5de08 ad49fd9 dc5de08 ad49fd9 8015fc4 dc5de08 8015fc4 dc5de08 b4c9157 |
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 35 |
import streamlit as st
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import io
import base64
st.set_page_config(layout="wide")
# Function for the CSV Visualization App
def app():
st.title('CSV Data Cleaning and Visualization')
uploaded_file = st.file_uploader("Upload your input CSV file", type=["csv"])
# Pandas DataFrame is created from the CSV file
if uploaded_file is not None:
df = pd.read_csv(uploaded_file)
st.write(df) # Display the dataframe on the app
# Create a selectbox for user to choose the column to visualize
columns = df.columns.tolist()
selected_column = st.selectbox('Select a column to visualize', columns)
# Using seaborn to create a count plot
fig, ax = plt.subplots()
sns.countplot(data=df, x=selected_column, ax=ax)
plt.xticks(rotation=45) # Rotate X-axis labels to 45 degrees
# Show the plot
st.pyplot(fig)
app()
|