4 ответов
+ 1
Pankaj Kumar Malviya ,
Here i did sum of the all passengers whose Fare is lessthan8 by adding extra column.
import pandas as pd
df = pd.read_csv('https://sololearn.com/uploads/files/titanic.csv')
df['lessthan8']= df['Fare'] < 8
is_less_8 = pd.Series(df['lessthan8'])
print(sum(df[is_less_8]['Fare'].values))
0
Let's say I have 1 column of some int data and other column for data I want to sum the data till a certain date
0
♤♢☞ 𝐊𝐢𝐢𝐛𝐨 𝐆𝐡𝐚𝐲𝐚𝐥 ☜♢♤ It is working for me. I don't know why not for you.
Please don't tag me if it works or not works, it is just a sample code.