题解 | #牛客网用户等级的中位数#
牛客网用户等级的中位数
https://www.nowcoder.com/practice/0e4374d166354a1d9c51c03b6ea7bc71
import pandas as pd df = pd.read_csv('Nowcoder.csv') pd.set_option('display.width', 300) # 设置字符显示宽度 pd.set_option('display.max_rows', None) # 设置显示最大行 pd.set_option('display.max_columns', None) # con = df['Num_of_exercise'] >=10 # df1 = df[con]['Level'].median() df1 = df[df['Num_of_exercise']>= 10]['Level'].median() df1 = int(df1) print(df1)
condition = df['col_name'] >=10
df[condition]['col_name'].max()