pandas库的一些操作

1.pd.value_count():带入数值可以计算出value有多少的类别

#得到类别的降序
tips['day'].value_counts(sort=True,ascending=True)

 2.sort_values()(按照数值进行排列)/sort_index()(对index/columns的大小进行排列),其中axis=0是默认的值,代表值列

3.reshape():一个2*3的Dataframe变成一个shape为(5,1)的dateframe,可以直接用data.reshape(-1,1),其中的-1是自动识别的意思

猜你喜欢

转载自www.cnblogs.com/yskn/p/9826027.html