数据蛙数据分析每周作业

【Python学习】No.7 Pandas常用函数(一)

2019-03-24  本文已影响0人  LL_路上

1.cut

pandas.cut(x, bins, right=True, labels=None, retbins=False, precision=3,include_lowest=False)

2.concat

pd.concat(objs, axis=0, join='outer', join_axes=None, ignore_index=False, keys=None, levels=None, names=None, verify_integrity=False,copy=True)

3.iloc与loc

pandas以类似字典的方式来获取某一列的值,比如df['A'],这会得到df的A列。如果我们对某一行感兴趣呢?这个时候有两种方法,一种是iloc方法,另一种方法是loc方法。loc是指location的意思,iloc中的i是指integer。这两者的区别如下:
• loc works on labels in the index.
• iloc works on the positions in the index (so it only takes integers).
也就是说loc是根据index来索引,那么loc就根据这个index来索引对应的行。iloc并不是根据index来索引,而是根据行号来索引,行号从0开始,逐次加1。

上一篇 下一篇

猜你喜欢

热点阅读