python的pandas重复值处理(duplicated()和drop_duplicates())
一、生成重复记录数据importnumpyasnpimportpandasaspd#生成重复数据df=pd.DataFrame(np.ones([5,2]),columns=['col1','col2'])df['col3']=['a','b','a','c','d']df['col4']=[3,2,3,2,2]df=df.reindex(columns=['col3','col4','col1'