Spaces:
Sleeping
Sleeping
Update pages/EDA.py
Browse files- pages/EDA.py +8 -12
pages/EDA.py
CHANGED
|
@@ -467,36 +467,32 @@ st.markdown("""
|
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
-
|
| 471 |
-
st.
|
| 472 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 473 |
sns.scatterplot(data=df, x="Rainfall", y="Crop", hue="Crop", palette="rainbow", legend=False, ax=ax)
|
| 474 |
ax.set_xlabel("Rainfall (mm)", fontsize=8)
|
| 475 |
ax.set_ylabel("Crop", fontsize=8)
|
| 476 |
-
ax.set_title("Rainfall vs Crop Type", fontsize=
|
| 477 |
st.pyplot(fig)
|
| 478 |
|
| 479 |
-
#
|
| 480 |
-
st.subheader("Temperature vs. Humidity")
|
| 481 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 482 |
sns.scatterplot(data=df, x="Temperature", y="Humidity", alpha=0.6, color="blue", ax=ax)
|
| 483 |
ax.set_xlabel("Temperature (°C)", fontsize=8)
|
| 484 |
ax.set_ylabel("Humidity (%)", fontsize=8)
|
| 485 |
-
ax.set_title("Temperature vs Humidity", fontsize=
|
| 486 |
st.pyplot(fig)
|
| 487 |
|
| 488 |
-
#
|
| 489 |
-
st.subheader("Correlation Heatmap of Soil & Climate Factors")
|
| 490 |
corr_matrix = df[['Nitrogen', 'Phosphorus', 'Potassium', 'Temperature', 'Humidity', 'pH_Value', 'Rainfall']].corr()
|
| 491 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 492 |
sns.heatmap(corr_matrix, annot=True, cmap="coolwarm", ax=ax)
|
| 493 |
-
ax.set_title("Correlation Heatmap", fontsize=
|
| 494 |
st.pyplot(fig)
|
| 495 |
|
| 496 |
-
#
|
| 497 |
-
st.subheader("🌾 Crop Recommendations by Season")
|
| 498 |
|
| 499 |
-
# **Define Seasonal Conditions**
|
| 500 |
summer_conditions = (df["Temperature"].between(20, 40)) & (df["Rainfall"].between(50, 200)) & (df["Humidity"].between(40, 70))
|
| 501 |
rainy_conditions = (df["Temperature"].between(20, 30)) & (df["Rainfall"] > 200) & (df["Humidity"].between(65, 95))
|
| 502 |
winter_conditions = (df["Temperature"].between(10, 20)) & (df["Rainfall"] < 150) & (df["Humidity"].between(30, 70))
|
|
|
|
| 467 |
|
| 468 |
|
| 469 |
|
| 470 |
+
|
| 471 |
+
st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Rainfall vs. Crop</h2>", unsafe_allow_html=True)
|
| 472 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 473 |
sns.scatterplot(data=df, x="Rainfall", y="Crop", hue="Crop", palette="rainbow", legend=False, ax=ax)
|
| 474 |
ax.set_xlabel("Rainfall (mm)", fontsize=8)
|
| 475 |
ax.set_ylabel("Crop", fontsize=8)
|
| 476 |
+
ax.set_title("Rainfall vs Crop Type", fontsize=7)
|
| 477 |
st.pyplot(fig)
|
| 478 |
|
| 479 |
+
st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Temperature vs. Humidity</h2>", unsafe_allow_html=True)
|
|
|
|
| 480 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 481 |
sns.scatterplot(data=df, x="Temperature", y="Humidity", alpha=0.6, color="blue", ax=ax)
|
| 482 |
ax.set_xlabel("Temperature (°C)", fontsize=8)
|
| 483 |
ax.set_ylabel("Humidity (%)", fontsize=8)
|
| 484 |
+
ax.set_title("Temperature vs Humidity", fontsize=7)
|
| 485 |
st.pyplot(fig)
|
| 486 |
|
| 487 |
+
st.markdown("<h2 style='color: #D35400; font-size: 23px;'> Correlation Heatmap of Soil & Climate Factors</h2>", unsafe_allow_html=True)
|
|
|
|
| 488 |
corr_matrix = df[['Nitrogen', 'Phosphorus', 'Potassium', 'Temperature', 'Humidity', 'pH_Value', 'Rainfall']].corr()
|
| 489 |
fig, ax = plt.subplots(figsize=(6, 4)) # Reduced size
|
| 490 |
sns.heatmap(corr_matrix, annot=True, cmap="coolwarm", ax=ax)
|
| 491 |
+
ax.set_title("Correlation Heatmap", fontsize=7)
|
| 492 |
st.pyplot(fig)
|
| 493 |
|
| 494 |
+
st.markdown("<h2 style='color: #D35400; font-size: 23px;'> 🌾 Crop Recommendations by Season</h2>", unsafe_allow_html=True)
|
|
|
|
| 495 |
|
|
|
|
| 496 |
summer_conditions = (df["Temperature"].between(20, 40)) & (df["Rainfall"].between(50, 200)) & (df["Humidity"].between(40, 70))
|
| 497 |
rainy_conditions = (df["Temperature"].between(20, 30)) & (df["Rainfall"] > 200) & (df["Humidity"].between(65, 95))
|
| 498 |
winter_conditions = (df["Temperature"].between(10, 20)) & (df["Rainfall"] < 150) & (df["Humidity"].between(30, 70))
|