Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import pandas as pd
|
| 3 |
+
import matplotlib.pyplot as plt
|
| 4 |
+
import seaborn as sns
|
| 5 |
+
from io import StringIO
|
| 6 |
+
|
| 7 |
+
def main():
|
| 8 |
+
st.title("PPDAC Data Analysis Toolkit")
|
| 9 |
+
|
| 10 |
+
# Problem
|
| 11 |
+
st.header("1. Problem")
|
| 12 |
+
problem = st.text_area("Define your problem:")
|
| 13 |
+
|
| 14 |
+
# Plan
|
| 15 |
+
st.header("2. Plan")
|
| 16 |
+
plan = st.text_area("Describe your plan:")
|
| 17 |
+
|
| 18 |
+
# Data
|
| 19 |
+
st.header("3. Data")
|
| 20 |
+
uploaded_file = st.file_uploader("Choose a CSV file", type="csv")
|
| 21 |
+
|
| 22 |
+
if uploaded_file is not None:
|
| 23 |
+
data = pd.read_csv(uploaded_file)
|
| 24 |
+
st.write(data.head())
|
| 25 |
+
|
| 26 |
+
# Analysis
|
| 27 |
+
st.header("4. Analysis")
|
| 28 |
+
|
| 29 |
+
# EDA
|
| 30 |
+
st.subheader("Exploratory Data Analysis")
|
| 31 |
+
|
| 32 |
+
# Summary statistics
|
| 33 |
+
st.write("Summary Statistics:")
|
| 34 |
+
st.write(data.describe())
|
| 35 |
+
|
| 36 |
+
# Correlation heatmap
|
| 37 |
+
st.write("Correlation Heatmap:")
|
| 38 |
+
fig, ax = plt.subplots(figsize=(10, 8))
|
| 39 |
+
sns.heatmap(data.corr(), annot=True, cmap='coolwarm', ax=ax)
|
| 40 |
+
st.pyplot(fig)
|
| 41 |
+
|
| 42 |
+
# Pairplot
|
| 43 |
+
st.write("Pairplot:")
|
| 44 |
+
fig = sns.pairplot(data)
|
| 45 |
+
st.pyplot(fig)
|
| 46 |
+
|
| 47 |
+
# Histogram
|
| 48 |
+
st.write("Histograms:")
|
| 49 |
+
for column in data.select_dtypes(include=['float64', 'int64']).columns:
|
| 50 |
+
fig, ax = plt.subplots()
|
| 51 |
+
sns.histplot(data[column], kde=True, ax=ax)
|
| 52 |
+
st.pyplot(fig)
|
| 53 |
+
|
| 54 |
+
# Conclusion
|
| 55 |
+
st.header("5. Conclusion")
|
| 56 |
+
conclusion = st.text_area("Write your conclusion based on the analysis:")
|
| 57 |
+
|
| 58 |
+
if __name__ == "__main__":
|
| 59 |
+
main()
|