Experimental Design in Python
James Chapman
Curriculum Manager, DataCamp
Light_Condition
) - two levels: Full Sunlight
and Partial Shade
Fertilizer_Type
) - two levels: Synthetic
and Organic
Growth_cm
plant_growth_data.head()
Plant_ID Light_Condition Fertilizer_Type Growth_cm
0 1 Full Sunlight Synthetic 16.489735
1 2 Partial Shade Organic 18.361689
2 3 Full Sunlight Synthetic 18.039459
3 4 Full Sunlight Organic 12.682425
4 5 Full Sunlight Organic 21.480601
plant_growth = pd.pivot_table(plant_growth_data, values='Growth_cm', index='Light_Condition', columns='Fertilizer_Type', aggfunc='mean')
plant_growth
Light_Condition Organic Synthetic
Full Sunlight 20.602 19.869
Partial Shade 20.246 20.326
import seaborn as sns
import matplotlib.pyplot as plt
sns.heatmap(plant_growth,
annot=True,
cmap='coolwarm',
fmt='g')
plt.show()
Light_Condition Organic Synthetic
Full Sunlight 20.602 19.869
Partial Shade 20.246 20.326
Experimental Design in Python