pandas 操作

1. 根据多列依次进行排序

https://yiyibooks.cn/meikunyuan6/pandas/pandas/generated/pandas.DataFrame.sort_values.html#pandas.DataFrame.sort_values

先根据第一列,然后再根据第二列进行排序

df.sort_values(by=['col1', 'col2'], ascending=[False,False])

 2. 根据某一列去重

https://yiyibooks.cn/meikunyuan6/pandas/pandas/generated/pandas.DataFrame.drop_duplicates.html#pandas.DataFrame.drop_duplicates

3. 根据某一列,计算分组情况

https://yiyibooks.cn/meikunyuan6/pandas/pandas/generated/pandas.DataFrame.groupby.html#pandas.DataFrame.groupby

data.groupby(['col1', 'col2']).size()

4. 

你可能感兴趣的:(python,pandas,python,数据分析)