python培训之filter()的多种筛选

发布时间:2023-02-24 09:42:02 人气:34 作者:多测师

  python中filter()的多种筛选

  1、筛选指定的列,类似于花式索引

  df2.filter(items=['one','three'])

  """

  one three

  mouse 1 3

  rabbit 4 6

  """

python培训之filter()的多种筛选

  2、筛选以字母e结尾的列

  df2.filter(regex='e$', axis=1)

  """

  one three

  mouse 1 3

  rabbit 4 6

  """

  3、筛选以字母e结尾的行

  df2.filter(regex='e$',axis=0)

  """

  one two three

  mouse 1 2 3

  """

  4、筛选行索引中有bbi的行

  df2.filter(like='bbi',axis=0)

  """

  one two three

  rabbit 4 5 6

  """

  以上就是python中filter()的多种筛选,希望对大家有所帮助。更多Python学习指路:请关注多测师。https://www.e70w.com/xwzx/




返回列表
在线客服
联系方式

热线电话

17727591462

上班时间

周一到周五

二维码
线