Created
July 9, 2019 06:34
-
-
Save pemagrg1/f587d7732fdc6ac449ac07fd1da2ec62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_total(df): | |
df.loc['Total'] = pd.Series(df['Marks'].sum(), index = ['Marks']) | |
return df | |
df = pd.DataFrame({'Subjects': ["Maths","Science","English"], 'Marks': [80,90,75]}) | |
df = df.reindex(columns=['Subjects','Marks']) | |
df = get_total(df) | |
df |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment