This is my first jupyter notebook

In [11]:
import matplotlib.pyplot as plt
import numpy as np
In [12]:
import pandas as pd

# Replace this path with the actual path to your file
file_path = "C:/Users/YourUsername/Documents/Group-Training-Male-Cancer-statistics.xlsx"  # Example Windows path
# OR
# file_path = "/Users/YourUsername/Documents/Group-Training-Male-Cancer-statistics.xlsx"  # Example Mac/Linux path

# Using the actual path directly with quotes
data = pd.read_excel("/Users/reneewang/Desktop/Group-Training-Male-Cancer-statistics.xlsx")

# Alternatively, you can use the file_path variable
# data = pd.read_excel(file_path)
In [13]:
data
Out[13]:
Unnamed: 0 Male %
0 Prostate 299010 29.0
1 Lung & bronchus 116310 11.0
2 Colon & rectum 81540 8.0
3 Urinary bladder 63070 6.0
4 Melanoma of the skin 59170 6.0
5 Kidney & renal pelvis 52380 5.0
6 Non-Hodgkin lymphoma 44590 4.0
7 Oral cavity & pharynx 41510 4.0
8 Leukemia 36450 4.0
9 Pancreas 34530 3.0
10 All sites 1029080 NaN
In [14]:
Cancers = data['Unnamed: 0']
Number = data['Male']
# The code below deletes the last row of the data so that the chart is accurate.
Number.drop(Number.tail(1).index,inplace=True)
Cancers.drop(Cancers.tail(1).index,inplace=True) 

fig, ax = plt.subplots()
ax.pie(Number, labels=Cancers)
plt.show()

# In the picture that was given there was no prostate cancer so this chart also doesn't have prostate cancer.
Number.drop(Number.head(1).index,inplace=True)
Cancers.drop(Cancers.head(1).index,inplace=True)

fig, ax = plt.subplots()
ax.pie(Number, labels=Cancers)
plt.show()    
No description has been provided for this image
No description has been provided for this image
In [ ]:
 
In [ ]: