varshitha22 commited on
Commit
190b2d1
·
verified ·
1 Parent(s): 6ecb34c

Update pages/EDA.py

Browse files
Files changed (1) hide show
  1. pages/EDA.py +10 -10
pages/EDA.py CHANGED
@@ -163,11 +163,11 @@ def plot_nutrient_crops(data, title):
163
  crop_counts = data.value_counts()
164
  fig, ax = plt.subplots(figsize=(6, 3)) # Adjusted plot size for better display
165
  crop_counts.plot(kind='bar', color='skyblue', ax=ax)
166
- ax.set_xlabel('Crops', fontsize=8)
167
- ax.set_ylabel('Count', fontsize=8)
168
- ax.set_title(title, fontsize=8)
169
- ax.tick_params(axis='x', labelsize=8) # Adjust x-axis label size
170
- ax.tick_params(axis='y', labelsize=8) # Adjust y-axis label size
171
  st.pyplot(fig)
172
 
173
  # Plot: Crops in Nutrient-Rich Soil
@@ -273,13 +273,13 @@ st.markdown("""
273
 
274
 
275
 
276
- st.markdown("<h2 style='text-align: left; color: #D35400;font-size: 23px;'>Crops that require above-average sclimate factors</h2>", unsafe_allow_html=True)
277
 
278
  # Calculate average of climate factors
279
- avg_nitrogen = df['Temperature'].mean()
280
- avg_phosphorus = df['Humidity'].mean()
281
- avg_potassium = df['pH_Value'].mean()
282
- avg_rainfall = df['Rainfall'].mean()
283
 
284
  # Function to plot bar charts
285
  def plot_climate_crops(data, title):
 
163
  crop_counts = data.value_counts()
164
  fig, ax = plt.subplots(figsize=(6, 3)) # Adjusted plot size for better display
165
  crop_counts.plot(kind='bar', color='skyblue', ax=ax)
166
+ ax.set_xlabel('Crops', fontsize=7)
167
+ ax.set_ylabel('Count', fontsize=7)
168
+ ax.set_title(title, fontsize=7)
169
+ ax.tick_params(axis='x', labelsize=7) # Adjust x-axis label size
170
+ ax.tick_params(axis='y', labelsize=7) # Adjust y-axis label size
171
  st.pyplot(fig)
172
 
173
  # Plot: Crops in Nutrient-Rich Soil
 
273
 
274
 
275
 
276
+ st.markdown("<h2 style='text-align: left; color: #D35400;font-size: 23px;'>Crops that require above-average climate factors</h2>", unsafe_allow_html=True)
277
 
278
  # Calculate average of climate factors
279
+ avg_Temperature = df['Temperature'].mean()
280
+ avg_Humidity = df['Humidity'].mean()
281
+ avg_pH_Value = df['pH_Value'].mean()
282
+ avg_Rainfall = df['Rainfall'].mean()
283
 
284
  # Function to plot bar charts
285
  def plot_climate_crops(data, title):