Spaces:
Runtime error
Runtime error
Add virtual environment and dependencies
Browse files- app.py +34 -0
- requirements.txt +2 -0
app.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
|
| 4 |
+
# Set the title of the app
|
| 5 |
+
st.title("CSV Viewer and Basic Stats")
|
| 6 |
+
|
| 7 |
+
# Create a file uploader
|
| 8 |
+
uploaded_file = st.file_uploader("Upload a CSV file", type=["csv"])
|
| 9 |
+
|
| 10 |
+
if uploaded_file:
|
| 11 |
+
# Read the uploaded CSV file
|
| 12 |
+
df = pd.read_csv(uploaded_file)
|
| 13 |
+
|
| 14 |
+
# Display the dataframe
|
| 15 |
+
st.write("### Uploaded Data")
|
| 16 |
+
st.write(df)
|
| 17 |
+
|
| 18 |
+
# Display basic statistics
|
| 19 |
+
st.write("### Basic Statistics")
|
| 20 |
+
st.write(df.describe())
|
| 21 |
+
|
| 22 |
+
# Display the column names
|
| 23 |
+
st.write("### Column Names")
|
| 24 |
+
st.write(df.columns.tolist())
|
| 25 |
+
|
| 26 |
+
# Allow the user to select a column for more detailed stats
|
| 27 |
+
column = st.selectbox("Select a column for more stats", df.columns)
|
| 28 |
+
|
| 29 |
+
if column:
|
| 30 |
+
st.write(f"### Statistics for {column}")
|
| 31 |
+
st.write(f"Mean: {df[column].mean()}")
|
| 32 |
+
st.write(f"Median: {df[column].median()}")
|
| 33 |
+
st.write(f"Standard Deviation: {df[column].std()}")
|
| 34 |
+
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
streamlit
|
| 2 |
+
pandas
|