0

I'm currently trying to write a program and I'm getting the following error:

AttributeError: 'numpy.float64' object has no attribute 'sort_index'

Does anyone know what this may be caused by? Here's my program as of right now (I'm still working on it but I'm a bit lost at the moment):

def 2000s(data, given_sex = 'A'):
"""
Take a dataframe and the sex as a parameter and return the mean
percent from 2000 to 2010 of the sex that recieved the two most
commonly awarded levels of educational attainment.
"""
# sex_find = data.groupby('Sex')['Total'].max()
# return sex_find[given_sex]
year1 = data[(data['Year'] <= 2010) & (data['Year'] >= 2000)]
sex_find = data.groupby('Sex')['Total'].max()
# given_sex = data['Sex'] == 'A'
return sex_find[given_sex]
ppboi
  • 13
  • 4

0 Answers0