Baby names - series object has no object search sorted
I'm trying to get through the baby names example walkthrough and came across an error that I'm not sure how to resolve. I was able to get through the first few steps of the 'measuring the increase in naming diversity' section, but was stumped by the following error message: "AttributeError: 'Series' object has no attribute 'searchsorted'

My full code is included below.

Thanks!

Measuring the increase in naming diversity

In [63]:
# One reason why these names appear to be falling out of favor is that parents are making more diverse choices
# Lets test this by evaluating the proportion of births represented by the top 1000 most common nanmes, aggregated by year + sex

table = top1000.pivot_table('prop', rows='year', cols='sex', 
                            aggfunc=sum)

table.plot(title='Sum of table1000.prop by year and sex',
           yticks=np.linspace(0, 1.2, 13), xticks=range(1880, 2020, 10))
Out[63]:
<matplotlib.axes.AxesSubplot at 0x10dab77d0>

Indeed it appears that there is an increase in naming diversity, as the proportion of baby names represented by the top 1000 names seems to decrease over the observed period.
In [64]:
# Another interesting measure is the number of distinct names,
# taken in order of popularity from highest to lowest, in the top 50% of births.

df = boys[boys.year == 2010]

df.info()
<class 'pandas.core.frame.DataFrame'>
MultiIndex: 1000 entries, (2010, M, 1676644) to (2010, M, 1677643)
Data columns (total 5 columns):
name      1000 non-null object
sex       1000 non-null object
births    1000 non-null int64
year      1000 non-null int64
prop      1000 non-null float64
dtypes: float64(1), int64(2), object(2)
In [65]:
# After sorting prop in descending order, we want to know how many of the most popular
# names it takes to represent 50% of the total # of births.
# Taking the cumulative sum <cumsum> of <prop> tgeb cakkubg tge netgid <searchsorted>
# returns the position in the cumulative sum at which 0.5 would need to be inserted to keep it in sorted order:

prop_cumsum = df.sort_index(by='prop', ascending=False).prop.cumsum()
In [66]:

prop_cumsum[:10]
Out[66]:
year  sex  
2010  M    1676644    0.011523
           1676645    0.020934
           1676646    0.029959
           1676647    0.038930
           1676648    0.047817
           1676649    0.056579
           1676650    0.065155
           1676651    0.073414
           1676652    0.081528
           1676653    0.089621
Name: prop, dtype: float64
In [67]:
## prop_cumsum.searchsorted(0.5)

AttributeError                            Traceback (most recent call last)
<ipython-input-67-f2e2bb3f5ba0> in <module>()
----> 1 prop_cumsum.searchsorted(0.5)

//anaconda/lib/python2.7/site-packages/pandas/core/generic.pyc in **getattr**(self, name)
   1813                 return self[name]
   1814             raise AttributeError("'%s' object has no attribute '%s'" %
-> 1815                                  (type(self).**name**, name))
   1816 
   1817     def **setattr**(self, name, value):

AttributeError: 'Series' object has no attribute 'searchsorted'
