DA43. 两份用户信息表格中的查找
描述
Python 3 解法, 执行用时: 797ms, 内存消耗: 524288KB, 提交时间: 2022-07-25
import pandas as pd Nowcoder1 = pd.read_csv('Nowcoder1.csv', sep=',') Nowcoder2 = pd.read_csv('Nowcoder2.csv', sep=',') df=pd.merge(Nowcoder1, Nowcoder2, on='Nowcoder_ID', how='inner') print(df[['Name','Num_of_exercise','Number_of_submissions']])
Python 3 解法, 执行用时: 801ms, 内存消耗: 524288KB, 提交时间: 2022-07-25
import pandas as pd Nowcoder1 = pd.read_csv('Nowcoder1.csv', sep=',') Nowcoder2 = pd.read_csv('Nowcoder2.csv', sep=',') data=pd.merge(Nowcoder1,Nowcoder2,how='inner',on='Nowcoder_ID') print(data[['Name','Num_of_exercise','Number_of_submissions']])
Python 3 解法, 执行用时: 805ms, 内存消耗: 524288KB, 提交时间: 2022-07-21
import pandas as pd Nowcoder1 = pd.read_csv('Nowcoder1.csv', sep=',') Nowcoder2 = pd.read_csv('Nowcoder2.csv', sep=',') data = pd.merge(Nowcoder1, Nowcoder2, on='Nowcoder_ID') print(data[['Name', 'Num_of_exercise', 'Number_of_submissions']])
Python 3 解法, 执行用时: 807ms, 内存消耗: 524288KB, 提交时间: 2022-07-22
import pandas as pd Nowcoder1 = pd.read_csv('Nowcoder1.csv', sep=',') Nowcoder2 = pd.read_csv('Nowcoder2.csv', sep=',') qs=pd.merge(Nowcoder1,Nowcoder2,on='Nowcoder_ID',how='outer') print(qs[['Name','Num_of_exercise','Number_of_submissions']])
Python 3 解法, 执行用时: 811ms, 内存消耗: 524288KB, 提交时间: 2022-07-25
import pandas as pd Nowcoder1 = pd.read_csv('Nowcoder1.csv', sep=',') Nowcoder2 = pd.read_csv('Nowcoder2.csv', sep=',') df=pd.merge(Nowcoder1,Nowcoder2, on="Nowcoder_ID", how="inner").reset_index(drop=True) print(df[["Name","Num_of_exercise","Number_of_submissions"]])