Python Forum
Help with pie chart in Jupyter notebook
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with pie chart in Jupyter notebook
#1
Hi All,

I can't find a button where I can upload pictures? There is one where I can put a link, but I don't have a link.

I'll have to try to explain it.

ns is my table of patients. I am trying to do some analysis on Gender and whether they showed up or not:

I am grouping as follows:

ns_gender = ns.groupby(['Gender','No_show']).count()['Age']
I am taking the "Age" column as an arbitrary column to retrieve the counts. However this poses a problem further on.

Now I get propotional values:
mal_prop = ns_gender['M'] / gender_tots['M']
fem_prop = ns_gender['F'] / gender_tots['F']
Now I plot pie charts:

mal_prop.plot.pie(subplots = True, figsize=(5, 5),autopct='%1.1f%%'), 
fem_prop.plot.pie(subplots = True, figsize=(5, 5),autopct='%1.1f%%')
I have two issues:

1) The pie charts now have a y = "Age" from before. I cannot change it to Male/Femal even if I put y = 'Male' in the code. How do I force the label?

2) My two pie charts overlap each other. Is there a way to move one of the pie charts to the right?

Thanks in advance. Sorry I have just started learning coding and am an absolute beginner!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  My code works on Jupyter Lab/Notebook, but NOT on Visual Code Editor jst 4 988 Nov-15-2023, 06:56 PM
Last Post: jst
  Navigating file directories and paths inside Jupyter Notebook Mark17 5 687 Oct-29-2023, 12:40 PM
Last Post: Mark17
  How to programmatically stop a program in Jupyter Notebook? Mark17 11 36,945 Feb-12-2023, 01:41 PM
Last Post: jp21in
Thumbs Up Python 3 Jupyter notebook ternary plot data nicholas 0 930 Jan-21-2023, 05:01 PM
Last Post: nicholas
  Graphs from Jupyter notebook to word Scott 0 880 Nov-28-2022, 06:16 AM
Last Post: Scott
  Opening an empty Jupyter notebook in VSCODE Krischu 3 1,823 Mar-09-2022, 01:57 PM
Last Post: Larz60+
  How to do line continuation in Jupyter Notebook? Mark17 4 5,452 Sep-22-2021, 04:22 PM
Last Post: ibreeden
  Jupyter Notebook as IDE bytecrunch 0 1,601 Sep-12-2021, 07:41 PM
Last Post: bytecrunch
  It says there is no keras in jupyter notebook. it is wrong there is a keras install Led_Zeppelin 0 1,874 Apr-27-2021, 08:29 PM
Last Post: Led_Zeppelin
  importing matplotlib in jupyter notebook Led_Zeppelin 4 3,454 Feb-25-2021, 07:28 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020