Q. Write a program that performs count, sum, max, and min functions:
(i) On rows
(ii) On columns
Answer =
#(i) On rows
import pandas as pd
import numpy as z
dict = { 'name' : [1, 2, 3] }
df = pd.DataFrame(dict)
df.min() #min
df.max() #max
df.count() #count
df.sum() #sum
#(ii) On column
df.min(axis = 1) #min
df.max(axis = 1) #max
df.count(axis = 1) #count
df.sum(axis = 1) #sum
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )