%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import os
data_filename = 'Popular_Baby_Names'
data = pd.read_csv("C:/Anaconda3/DataSet/Popular_Baby_Names.csv", index_col='Gender')
data2 =data.rename(columns={"Year of Birth":"YoB"},inplace=True)
data2
groups = data.groupby(data.Ethnicity)
groups
groups.sum()
I'm dealing with a CSV file.
The plot is the execution result. I'm going to erase the columns of YOB and Rank to graph the number of each race here.
del data2["Rank"]
If you try to erase Rank and YoB as above, the error 'NoneType' object does not support item deletion
appears, but I don't know what the problem is Help me
groups = data[['Count']].groupby(data.Ethnicity)
You can select series using [] as shown above.
Check out the link below (azure notebook).
© 2024 OneMinuteCode. All rights reserved.