题解 | #Python用户的平均提交次数#
Python用户的平均提交次数
https://www.nowcoder.com/practice/278b129eaadc477ebbd7cb929d4afa6c
import pandas as pd import numpy data = pd.read_csv("Nowcoder.csv", sep=",") pd.set_option("display.width", 300) pd.set_option("display.max_rows", None) pd.set_option("display.max_columns", None) # print(round(data[data['Language']=='Python']['Number_of_submissions'].mean(),1)) print( round( data[data["Language"] == "Python"]["Number_of_submissions"].sum() / data["Language"].value_counts()["Python"], 1, ) )