Skip to content

Commit 82d987b

Browse files
authored
Update README.md
Added the 'edibleclass' Groupby Class code. Updated the PNG files for the pie and donut chart.
1 parent 000b2fe commit 82d987b

File tree

1 file changed

+8
-2
lines changed
  • 3-Data-Visualization/11-visualization-proportions

1 file changed

+8
-2
lines changed

3-Data-Visualization/11-visualization-proportions/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Take this data and convert the 'class' column to a category:
5757
cols = mushrooms.select_dtypes(["object"]).columns
5858
mushrooms[cols] = mushrooms[cols].astype('category')
5959
```
60+
61+
```python
62+
edibleclass=mushrooms.groupby(['class']).count()
63+
edibleclass
64+
```
65+
6066
Now, if you print out the mushrooms data, you can see that it has been grouped into categories according to the poisonous/edible class:
6167

6268

@@ -78,7 +84,7 @@ plt.show()
7884
```
7985
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!
8086

81-
![pie chart](images/pie1.png)
87+
![pie chart](images/pie1-wb.png)
8288

8389
## Donuts!
8490

@@ -108,7 +114,7 @@ plt.title('Mushroom Habitats')
108114
plt.show()
109115
```
110116

111-
![donut chart](images/donut.png)
117+
![donut chart](images/donut-wb.png)
112118

113119
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.
114120

0 commit comments

Comments
 (0)