From 82d987b4aeb9c3e2eb367dad350073c9359c87ac Mon Sep 17 00:00:00 2001 From: Frederick Legaspi Date: Tue, 30 Nov 2021 15:04:48 -0500 Subject: [PATCH] Update README.md Added the 'edibleclass' Groupby Class code. Updated the PNG files for the pie and donut chart. --- .../11-visualization-proportions/README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/3-Data-Visualization/11-visualization-proportions/README.md b/3-Data-Visualization/11-visualization-proportions/README.md index bce02c2..2f265e7 100644 --- a/3-Data-Visualization/11-visualization-proportions/README.md +++ b/3-Data-Visualization/11-visualization-proportions/README.md @@ -57,6 +57,12 @@ Take this data and convert the 'class' column to a category: cols = mushrooms.select_dtypes(["object"]).columns mushrooms[cols] = mushrooms[cols].astype('category') ``` + +```python +edibleclass=mushrooms.groupby(['class']).count() +edibleclass +``` + Now, if you print out the mushrooms data, you can see that it has been grouped into categories according to the poisonous/edible class: @@ -78,7 +84,7 @@ plt.show() ``` Voila, a pie chart showing the proportions of this data according to these two classes of mushrooms. It's quite important to get the order of the labels correct, especially here, so be sure to verify the order with which the label array is built! -![pie chart](images/pie1.png) +![pie chart](images/pie1-wb.png) ## Donuts! @@ -108,7 +114,7 @@ plt.title('Mushroom Habitats') plt.show() ``` -![donut chart](images/donut.png) +![donut chart](images/donut-wb.png) This code draws a chart and a center circle, then adds that center circle in the chart. Edit the width of the center circle by changing `0.40` to another value.