Update pages/2_Data_CLeaning_and_Preprocessing.py
Browse files
pages/2_Data_CLeaning_and_Preprocessing.py
CHANGED
|
@@ -26,7 +26,7 @@ if uploaded_file is not None:
|
|
| 26 |
data = pd.read_csv(uploaded_file)
|
| 27 |
st.session_state['df'] = data # Store the data for use in other pages
|
| 28 |
st.success("Dataset uploaded successfully!")
|
| 29 |
-
|
| 30 |
# Show Data Preview
|
| 31 |
st.write("### Preview of Dataset")
|
| 32 |
st.dataframe(data.head())
|
|
@@ -49,14 +49,14 @@ if uploaded_file is not None:
|
|
| 49 |
st.write("### Histograms for Numeric Columns")
|
| 50 |
for col in numeric_columns:
|
| 51 |
fig, ax = plt.subplots()
|
| 52 |
-
sns.histplot(data[col], kde=True, ax=ax)
|
| 53 |
ax.set_title(f'Histogram of {col}')
|
| 54 |
st.pyplot(fig)
|
| 55 |
|
| 56 |
st.write("### Boxplots for Numeric Columns")
|
| 57 |
for col in numeric_columns:
|
| 58 |
fig, ax = plt.subplots()
|
| 59 |
-
sns.boxplot(x=data[col], ax=ax)
|
| 60 |
ax.set_title(f'Boxplot of {col}')
|
| 61 |
st.pyplot(fig)
|
| 62 |
else:
|
|
@@ -72,7 +72,7 @@ if uploaded_file is not None:
|
|
| 72 |
st.write(data[selected_cat_col].value_counts())
|
| 73 |
|
| 74 |
fig, ax = plt.subplots()
|
| 75 |
-
sns.countplot(x=selected_cat_col, data=data, ax=ax)
|
| 76 |
ax.set_title(f'Bar Plot of {selected_cat_col}')
|
| 77 |
st.pyplot(fig)
|
| 78 |
else:
|
|
@@ -103,11 +103,11 @@ if uploaded_file is not None:
|
|
| 103 |
if 'Category' in data.columns:
|
| 104 |
st.write("### Bar Plot for Category")
|
| 105 |
fig, ax = plt.subplots()
|
| 106 |
-
sns.countplot(x='Category', data=data, palette='
|
| 107 |
st.pyplot(fig)
|
| 108 |
else:
|
| 109 |
st.warning("'Category' column not found for plotting.")
|
| 110 |
-
|
| 111 |
# Binning of age column
|
| 112 |
bins = [0, 18, 35, 50, 65, 100]
|
| 113 |
labels = ['Child', 'Young Adult', 'Adult', 'Middle Aged', 'Senior']
|
|
|
|
| 26 |
data = pd.read_csv(uploaded_file)
|
| 27 |
st.session_state['df'] = data # Store the data for use in other pages
|
| 28 |
st.success("Dataset uploaded successfully!")
|
| 29 |
+
|
| 30 |
# Show Data Preview
|
| 31 |
st.write("### Preview of Dataset")
|
| 32 |
st.dataframe(data.head())
|
|
|
|
| 49 |
st.write("### Histograms for Numeric Columns")
|
| 50 |
for col in numeric_columns:
|
| 51 |
fig, ax = plt.subplots()
|
| 52 |
+
sns.histplot(data[col], kde=True, palette="crest", ax=ax)
|
| 53 |
ax.set_title(f'Histogram of {col}')
|
| 54 |
st.pyplot(fig)
|
| 55 |
|
| 56 |
st.write("### Boxplots for Numeric Columns")
|
| 57 |
for col in numeric_columns:
|
| 58 |
fig, ax = plt.subplots()
|
| 59 |
+
sns.boxplot(x=data[col], palette="mako", ax=ax)
|
| 60 |
ax.set_title(f'Boxplot of {col}')
|
| 61 |
st.pyplot(fig)
|
| 62 |
else:
|
|
|
|
| 72 |
st.write(data[selected_cat_col].value_counts())
|
| 73 |
|
| 74 |
fig, ax = plt.subplots()
|
| 75 |
+
sns.countplot(x=selected_cat_col, data=data, palette="viridis", ax=ax)
|
| 76 |
ax.set_title(f'Bar Plot of {selected_cat_col}')
|
| 77 |
st.pyplot(fig)
|
| 78 |
else:
|
|
|
|
| 103 |
if 'Category' in data.columns:
|
| 104 |
st.write("### Bar Plot for Category")
|
| 105 |
fig, ax = plt.subplots()
|
| 106 |
+
sns.countplot(x='Category', data=data, palette='plasma', ax=ax)
|
| 107 |
st.pyplot(fig)
|
| 108 |
else:
|
| 109 |
st.warning("'Category' column not found for plotting.")
|
| 110 |
+
|
| 111 |
# Binning of age column
|
| 112 |
bins = [0, 18, 35, 50, 65, 100]
|
| 113 |
labels = ['Child', 'Young Adult', 'Adult', 'Middle Aged', 'Senior']
|