Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with 1 . 5 . I am getting errors: - - - - - - - - - - - - -
I need help with I am getting errors:
KeyError Traceback most recent call last
Cell In line
#TODO Add Code to find the top donors supporting each committee.
groupcol topdonors', 'topcommittees'
campaignsbydonor dfgroupbygroupcolcontributionreceiptamount'sumresetindex
campaignsbydonors
# when you are done this should display the first five rows from your new dataframe
File ~anacondalibpythonsitepackagespandascoreframepy: in DataFrame.groupbyself by axis, level, asindex, sort, groupkeys, squeeze, observed, dropna
raise TypeErrorYou have to supply one of by and 'level'"
axis self.getaxisnumberaxis
return DataFrameGroupBy
objself,
keysby
axisaxis,
levellevel,
asindexasindex,
sortsort,
groupkeysgroupkeys,
squeezesqueeze,
observedobserved,
dropnadropna,
File ~anacondalibpythonsitepackagespandascoregroupbygroupbypy: in GroupBy.initself obj, keys, axis, level, grouper, exclusions, selection, asindex, sort, groupkeys, squeeze, observed, mutated, dropna
if grouper is None:
from pandas.core.groupby.grouper import getgrouper
grouper, exclusions, obj getgrouper
obj,
keys,
axisaxis,
levellevel,
sortsort,
observedobserved,
mutatedself.mutated,
dropnaself.dropna,
self.obj obj
self.axis obj.getaxisnumberaxis
File ~anacondalibpythonsitepackagespandascoregroupbygrouperpy: in getgrouperobj key, axis, level, sort, observed, mutated, validate, dropna
inaxis, level, gpr False, gpr None
else:
raise KeyErrorgpr
elif isinstancegpr Grouper and gprkey is not None:
# Add key to exclusions
exclusions.addgprkey
KeyError: 'topdonors'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started