Spaces:
Sleeping
Sleeping
Update pages/EDA.py
Browse files- pages/EDA.py +7 -5
pages/EDA.py
CHANGED
|
@@ -81,7 +81,7 @@ st.markdown("""
|
|
| 81 |
</div>
|
| 82 |
""", unsafe_allow_html=True)
|
| 83 |
|
| 84 |
-
st.markdown("<h2 style='text-align: left; color: #
|
| 85 |
# List of available visualizations
|
| 86 |
visualizations = [
|
| 87 |
"Nitrogen Requirement per Crop",
|
|
@@ -125,6 +125,8 @@ def plot_feature(feature, title):
|
|
| 125 |
|
| 126 |
|
| 127 |
|
|
|
|
|
|
|
| 128 |
crop_counts = df['Crop'].value_counts()
|
| 129 |
explode = [0.1 if i == 0 else 0 for i in range(len(crop_counts))]
|
| 130 |
|
|
@@ -134,11 +136,11 @@ ax.pie(
|
|
| 134 |
startangle=140, explode=explode, colors=sns.color_palette("rainbow", len(crop_counts)),
|
| 135 |
textprops={'fontsize': 3} # Decreased label size
|
| 136 |
)
|
| 137 |
-
ax.set_title("Proportion of Crops", fontsize=
|
| 138 |
st.pyplot(fig)
|
| 139 |
|
| 140 |
# Above-Average Nutrient Requirement Crops
|
| 141 |
-
st.markdown("<h2 style='text-align: left; color: #2E86C1;font-size:
|
| 142 |
|
| 143 |
# Calculate average nutrient levels
|
| 144 |
avg_nitrogen = df['Nitrogen'].mean()
|
|
@@ -186,7 +188,7 @@ st.markdown("""
|
|
| 186 |
""", unsafe_allow_html=True)
|
| 187 |
|
| 188 |
# Below-Average Nutrient Requirement Crops
|
| 189 |
-
st.markdown("<h2 style='text-align: left; color: #
|
| 190 |
|
| 191 |
# Plot: Crops in Nutrient-Poor Soil
|
| 192 |
less_avg_of_soil_nutrients = df[
|
|
@@ -198,7 +200,7 @@ less_avg_of_soil_nutrients = df[
|
|
| 198 |
plot_nutrient_crops(less_avg_of_soil_nutrients, "Crops Growing in Nutrient-Poor Soil")
|
| 199 |
|
| 200 |
# Insights for Nutrient-Poor Crops
|
| 201 |
-
st.markdown("<h2 style='color: #
|
| 202 |
st.markdown("""
|
| 203 |
<style>
|
| 204 |
.insights-box {
|
|
|
|
| 81 |
</div>
|
| 82 |
""", unsafe_allow_html=True)
|
| 83 |
|
| 84 |
+
st.markdown("<h2 style='text-align: left; color: #D35400;font-size: 23px;'>Crop Recommendation System - Feature Visualization</h2>", unsafe_allow_html=True)
|
| 85 |
# List of available visualizations
|
| 86 |
visualizations = [
|
| 87 |
"Nitrogen Requirement per Crop",
|
|
|
|
| 125 |
|
| 126 |
|
| 127 |
|
| 128 |
+
|
| 129 |
+
|
| 130 |
crop_counts = df['Crop'].value_counts()
|
| 131 |
explode = [0.1 if i == 0 else 0 for i in range(len(crop_counts))]
|
| 132 |
|
|
|
|
| 136 |
startangle=140, explode=explode, colors=sns.color_palette("rainbow", len(crop_counts)),
|
| 137 |
textprops={'fontsize': 3} # Decreased label size
|
| 138 |
)
|
| 139 |
+
ax.set_title("Proportion of Crops", fontsize=3)
|
| 140 |
st.pyplot(fig)
|
| 141 |
|
| 142 |
# Above-Average Nutrient Requirement Crops
|
| 143 |
+
st.markdown("<h2 style='text-align: left; color: #2E86C1;font-size: 24px;'>Crops that require above-average soil nutrients</h2>", unsafe_allow_html=True)
|
| 144 |
|
| 145 |
# Calculate average nutrient levels
|
| 146 |
avg_nitrogen = df['Nitrogen'].mean()
|
|
|
|
| 188 |
""", unsafe_allow_html=True)
|
| 189 |
|
| 190 |
# Below-Average Nutrient Requirement Crops
|
| 191 |
+
st.markdown("<h2 style='text-align: left; color: #D35400;font-size: 23px;'>Crops that require below-average soil nutrients</h2>", unsafe_allow_html=True)
|
| 192 |
|
| 193 |
# Plot: Crops in Nutrient-Poor Soil
|
| 194 |
less_avg_of_soil_nutrients = df[
|
|
|
|
| 200 |
plot_nutrient_crops(less_avg_of_soil_nutrients, "Crops Growing in Nutrient-Poor Soil")
|
| 201 |
|
| 202 |
# Insights for Nutrient-Poor Crops
|
| 203 |
+
st.markdown("<h2 style='color: #D35400; font-size: 23px;'>Insights:</h2>", unsafe_allow_html=True)
|
| 204 |
st.markdown("""
|
| 205 |
<style>
|
| 206 |
.insights-box {
|