I have the following data frame in Pandas ...
+-----------------------+
| | count |
+-----------------------+
| group | |
+-----------------------+
| 11- | 99435 |
+-----------------------+
| Bachelor+ | 64900 |
+-----------------------+
| Just 12 | 162483 |
+-----------------------+
| Some College | 61782 |
+-----------------------+
I want to execute the following code, but I get an error ...
death_2013['percent_of_total'] = death_2013.count.apply(
lambda x: (x / death_2013.count.sum()))
I get the following error ...
AttributeError: 'function' object has no attribute 'apply'
I checked death_2013.dtypesand count- this is int64. I can not understand what is wrong with the code.
source
share