DA21. 大佬用户成就值比例
描述
Python 3 解法, 执行用时: 783ms, 内存消耗: 524288KB, 提交时间: 2022-07-26
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') total=Nowcoder['Achievement_value'].sum() print(Nowcoder[Nowcoder['Level']==7]['Achievement_value']/total)
Python 3 解法, 执行用时: 785ms, 内存消耗: 524288KB, 提交时间: 2022-07-24
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') sum_=Nowcoder['Achievement_value'].sum() Nowcoder=Nowcoder.query('Level==7') print(Nowcoder['Achievement_value'].apply(lambda x: x/sum_))
Python 3 解法, 执行用时: 786ms, 内存消耗: 524288KB, 提交时间: 2022-07-23
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') print(Nowcoder[Nowcoder.Level==7].Achievement_value/Nowcoder.Achievement_value.sum())
Python 3 解法, 执行用时: 793ms, 内存消耗: 524288KB, 提交时间: 2022-07-23
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') #所有成绩总和 total=Nowcoder['Achievement_value'].sum() #大佬 df=Nowcoder[Nowcoder['Level']==7]['Achievement_value'] print(df/total)
Python 3 解法, 执行用时: 794ms, 内存消耗: 524288KB, 提交时间: 2022-07-21
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') total=Nowcoder['Achievement_value'].sum() print(Nowcoder['Achievement_value']/total) #df=Nowcoder[Nowcoder['Level']==7]['Achievement_value'] #df1 = df['Achievement_value']/df['Achievement_value'].sum() #print(df1)