- Matplotlib 3.0 Cookbook
- Srinivasa Rao Poladi
- 65字
- 2025-04-04 16:06:37
How to do it...
The following is the code block that plots three box plots, one for each of the attributes:
- Read the data from a CSV file into a pandas DataFrame:
wine_quality = pd.read_csv('winequality.csv', delimiter=';')
- Create a data list with three attributes of the Wine Quality dataset:
data = [wine_quality['alcohol'], wine_quality['fixed acidity'],
wine_quality['quality']]
- Plot the boxplot:
plt.boxplot(data)
- Display the plot on the screen:
plt.show()