Pandas中的DataFrame.filter()

时间:2017-05-31 23:48:38   收藏:0   阅读:2033
>>> df
one  two  three
mouse     1    2      3
rabbit    4    5      6
>>> # select columns by name
>>> df.filter(items=[one, three])
one  three
mouse     1      3
rabbit    4      6
>>> # select columns by regular expression
>>> df.filter(regex=e$, axis=1)
one  three
mouse     1      3
rabbit    4      6
>>> # select rows containing ‘bbi‘
>>> df.filter(like=bbi, axis=0)
one  two  three
rabbit    4    5      6

 

原文:http://www.cnblogs.com/zhangshilin/p/6926324.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!