DA11. 按照毕业年份与使用语言筛选牛客网7级用户
描述
Python 3 解法, 执行用时: 788ms, 内存消耗: 524288KB, 提交时间: 2022-08-01
import pandas as pd Nowcoder = 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(Nowcoder.query("Language == 'CPP' & Level == 7 & Graduate_year != 2018")) #print(Nowcoder.query("Level == 7 & Language == 'CPP' & Graduate_year != 2018")) #print(Nowcoder[(Nowcoder.Language =='CPP') & (Nowcoder.Level == 7) & (Nowcoder.Graduate_year !=2018)]) print(Nowcoder[(Nowcoder.Language=='CPP')&(Nowcoder.Level==7)&(Nowcoder.Graduate_year!=2018)])
Python 3 解法, 执行用时: 789ms, 内存消耗: 524288KB, 提交时间: 2022-08-02
import pandas as pd Nowcoder = 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(Nowcoder.loc[(Nowcoder['Level']==7) & (Nowcoder['Graduate_year'] != 2018) & (Nowcoder['Language'] == 'CPP'),:])
Python 3 解法, 执行用时: 794ms, 内存消耗: 524288KB, 提交时间: 2022-07-25
import pandas as pd Nowcoder = 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) data = Nowcoder[(Nowcoder['Language'] == "CPP") & (Nowcoder['Level'] == 7) & (Nowcoder['Graduate_year'] != 2018)] print(data)
Python 3 解法, 执行用时: 795ms, 内存消耗: 524288KB, 提交时间: 2022-07-27
import pandas as pd Nowcoder = 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) con1 = Nowcoder['Level']==7 con2 = Nowcoder['Language']=='CPP' con3 = Nowcoder['Graduate_year']!=2018 print(Nowcoder[con1 & con2 & con3])
Python 3 解法, 执行用时: 796ms, 内存消耗: 524288KB, 提交时间: 2022-07-20
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') # print(Nowcoder.query("Language=='CPP' & Level==7 & Graduate_year!=2018")) pd.set_option('display.width',300) #设置字符显示宽度 pd.set_option('display.max_rows',None) #设置显示最大行 pd.set_option('display.max_columns',None) print(Nowcoder.query("Language=='CPP' & Level==7 & Graduate_year!=2018"))