Reputation: 1
I have a code, I want to change the name of "UC" column as "No.of RCA". Please help me in it.
here is the code
agency.groupby(['Agency']).agg({
'UC':'count',
'Total number of children aged 9 months less to 15 years assessed in this RCA':'sum',
'Total number of children received TCV':'sum',
'nonvaccinated':'sum'})
Upvotes: 0
Views: 67
Reputation: 71689
You can use DataFrame.rename
to rename the columns as required.
Use:
agency.groupby(['Agency']).agg({
'UC':'count',
'Total number of children aged 9 months less to 15 years assessed in this RCA':'sum',
'Total number of children received TCV':'sum',
'nonvaccinated':'sum'}).rename(columns={"UC": "No. of RCA"})
Upvotes: 2
Reputation: 389
For renaming column_name we use .rename function:
agency = agency.rename(columns={'UC': 'No.of RCA'})
Upvotes: 2