作者:风控猎人
本期的主题是关于python的一个数据分析工具pandas的,归纳整理了一些工作中常用到的pandas使用技巧,方便更高效地实现数据分析。...':['s1', 'exp_s2', 's3','exps4'], 'c':[5,6,7,8], 'd':[3,2,5,10]})
df[df['b'].str.contains('exp')]
5.组内排序...df = pd.DataFrame([['A',1],['A',3],['A',2],['B',5],['B',9]], columns = ['name','score'])
介绍两种高效地组内排序的方法...20,30], [30,40]]})
df
df_new = df.列2.apply(pd.Series)
pd.concat([df,df_new], axis='columns')
12.用多个函数聚合...data/chipotle.tsv', sep='\t')
orders.groupby('order_id').item_price.agg(['sum','count']).head()
13.分组聚合