https://study.163.com/course/courseMain.htm?courseId=1006383008&share=2&shareId=400000000398149(博主录制)

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.filter.html(官网介绍)

DataFrame.filter(selfitems=Nonelike=Noneregex=Noneaxis=None)[source]

Subset rows or columns of dataframe according to labels in the specified index.

Note that this routine does not filter a dataframe on its contents. The filter is applied to the labels of the index.

Parameters:
items : list-like

Keep labels from axis which are in items.

like : string

Keep labels from axis for which “like in label == True”.

regex : string (regular expression)

Keep labels from axis for which re.search(regex, label) == True.

axis : int or string axis name

The axis to filter on. By default this is the info axis, ‘index’ for Series, ‘columns’ for DataFrame.

python脚本
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 8 11:32:40 2019 @author: QQ231469242
"""
import pandas as pd
import numpy as np df = pd.DataFrame(np.array(([1, 2, 3], [4, 5, 6])),
index=['mouse', 'rabbit'],
columns=['one', 'two', 'three']) df.filter(items=['one', 'three']) #select columns by regular expression
df.filter(regex='e$', axis=1) # select rows containing 'bbi'
df.filter(like='bbi', axis=0)

  

https://study.163.com/provider/400000000398149/index.htm?share=2&shareId=400000000398149(博主视频教学主页)

pandas filter数据筛选的更多相关文章

  1. pandas的数据筛选之isin和str.contains函数

    筛选是在平时的工作中使用非常频繁的功能,前文介绍了loc和iloc的筛选方法,现在继续介绍一些筛选的方法.   DataFrame列表 以>,<,==,>=,<=来进行选择(& ...

  2. 4、pandas的数据筛选之isin和str.contains函数

    DataFrame列表: 以>,<,==,>=,<=来进行选择(“等于”一定是用‘==’,如果用‘=’就不是判断大小了): 使用 &(且) 和 |(或) 时每个条件都要 ...

  3. 【转载】使用Pandas对数据进行筛选和排序

    使用Pandas对数据进行筛选和排序 本文转载自:蓝鲸的网站分析笔记 原文链接:使用Pandas对数据进行筛选和排序 目录: sort() 对单列数据进行排序 对多列数据进行排序 获取金额最小前10项 ...

  4. Python day11 filter函数筛选数据,reduce函数压缩数据的源码详解

    1.filter滤波器函数定义一个数组,需求:过滤出带ii的字符串 arr=['dsdsdii','qqwe','pppdiimmm','sdsa','sshucsii','iisdsa'] def ...

  5. python之pandas数据筛选和csv操作

    本博主要总结DaraFrame数据筛选方法(loc,iloc,ix,at,iat),并以操作csv文件为例进行说明 1. 数据筛选 a b c (1)单条件筛选 df[df[] # 如果想筛选a列的取 ...

  6. Pandas 数据筛选,去重结合group by

    Pandas 数据筛选,去重结合group by 需求 今小伙伴有一个Excel表, 是部门里的小伙9月份打卡记录, 关键字段如下: 姓名, 工号, 日期, 打卡方式, 时间, 详细位置, IP地址. ...

  7. django-filter 使用Filter来筛选你的数据

    django-filter Django-filter is a generic, reusable application to alleviate writing some of the more ...

  8. ASP.NET MVC5+EF6+EasyUI 后台管理系统(81)-数据筛选(万能查询)

    系列目录 前言 听标题的名字似乎是一个非常牛X复杂的功能,但是实际上它确实是非常复杂的,我们本节将演示如何实现对数据,进行组合查询(数据筛选) 我们都知道Excel中是如何筛选数据的.就像下面一样 他 ...

  9. 4-Pandas之数据类型与数据筛选

    一.数据类型 1.Pandas的数据类型主要结合了pandas和numpy两个模块中的数据类型,包括以下几种: float int bool datetime64[ns]------>日期类型 ...

随机推荐

  1. windows下binlog问题解决

    1.先确定mysql是否开启了binlog show binary logs; 默认情况下是不开启的 2.如何开启 在my.ini配置下添加两个参数 # Binary Logginglog-bin=m ...

  2. selenium安装并导入pycharm

    selenium安装 1.python的pip安装,命令pip install selenium 2.检查是否成功安装 打开pycharm-->File-->Settings-->P ...

  3. MySQL DataType--浮点数(Floating-Point Types)学习

    浮点数(Floating-Point Types) MySQL支持两种浮点数类型来表示近似值:1.FLOAT,单精度浮点数,使用4字节存储,存储数据范围3.402823466E+38 - -1.175 ...

  4. W3C--BOM(1)知识梳理

    <一>BOM浏览器对象模型 1. window 1.1 window.innerHeight浏览器窗口的内部高度,window.innerWidth浏览器窗口的内部宽度  (对于Inter ...

  5. SQL进阶系列之4HAVING字句的力量

    写在前面 SQL是面向集合的语言,与面向过程和面向对象语言都不一样 寻找缺失的编号 /* 寻找缺失的编号 */ CREATE TABLE SeqTbl (seq INTEGER PRIMARY KEY ...

  6. python测试开发django-rest-framework-61.权限认证(permission)

    前言 用户登录后,才有操作当前用户的权限,不能操作其它人的用户,这就是需要用到权限认证,要不然你登录自己的用户,去操作别人用户的相关数据,就很危险了. authentication是身份认证,判断当前 ...

  7. 实用的Python库

    一.Django 1.自动实现图片压缩: pip install easy-thumbnails / https://pypi.org/project/easy-thumbnails/2.实现定时任务 ...

  8. Spring源码窥探之:声明式事务

    1. 导入驱动,连接池,jdbc和AOP的依赖 <!-- c3p0数据库连接池 --> <dependency> <groupId>c3p0</groupId ...

  9. [NPM + React] Prepare a Custom React Hook to be Published as an npm Package

    Before we publish our package, we want to make sure everything is set up correctly. We’ll cover vers ...

  10. LeetCode 877. Stone Game

    原题链接在这里:https://leetcode.com/problems/stone-game/ 题目: Alex and Lee play a game with piles of stones. ...