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. 1行Python代码制作动态二维码

    原文地址 https://blog.csdn.net/m0_38106923/article/details/100603516 GitHub网站参见:https://github.com/sylns ...

  2. pgrep,pkill

    pgrep, pkill - look up or signal processes based on name and other attributes 根据名称和其它属性来查找进程 pgrep: ...

  3. linux中apt-get使用

    apt-get简介 在Ubuntu系统中,经常要用到apt-get install指令来安装软件,由于常常需要root权限来操作,所以搭配sudo食用口感更佳,apt-get指令对于安装.卸载.升级软 ...

  4. 数据库系统load飙高问题解决思路(转)

    工作过程中有时候会接收到数据库服务器器load 飙高的报警,比如:  load1 15.25 base: 8.52,collect time:2014-08-30 如何处理load 异常飙高的报警呢? ...

  5. jquery 表单对象属性筛选选择器

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content ...

  6. java 的任意进制间转换

    直接上代码: public class Main { public static void main(String[] args) { // TODO Auto-generated method st ...

  7. python 查询文件修改python lib 库文件

    运行code import os, time import sys import re def search(path, name): for root, dirs, files in os.walk ...

  8. janusgraph批量导入数据-IBM( janusgraph-utils)的使用

    janusgraph-utils的简介 可与JanusGraph一起使用的实用工具,包括: JanusGraphSchemaImporter:一个groovy脚本,它将图形模式定义(JanusGrap ...

  9. po模式

    一条测试用例可能需要多个步骤操作元素,将每一个步骤单独封装成一个方法,在执行测试用例时调用封装好的方法进行操作.PO模式可以把一个页面分为三个层级,对象库层.操作层.业务层. 对象库层:封装定位元素的 ...

  10. Java字符串之间拼接时,如果有null值,则会直接拼接上null

    package com.fgy.demo; public class demo06 { public static void main(String[] args) { String str1 = & ...