Python Pandas Tutorial: Different ways to filter Pandas DataFrame #9

  Рет қаралды 6,993

Programming Is Fun

Programming Is Fun

Күн бұрын

In this video lecture you will learn different ways to filter the data from Pandas DataFrame.
Introducing Pandas Query - Dynamic Data Filtering
What to do when the filtering criteria move too much?
Pandas has easy-to-use tools to filter your DataFrames, however the basic methods - like loc, iloc, or passing a boolean expression - lack the ability to use them comfortably when the filtering parameters are not static. The query DataFrame method offers a solution for this problem.
Data Filtering is one of the most frequent data manipulation operation. It is similar to WHERE clause in SQL or you must have used filter in MS Excel for selecting specific rows based on some conditions. In terms of speed, python has an efficient way to perform filtering and aggregation. It has an excellent package called pandas for data wrangling tasks.
You will learn:
1.) Apply filter single value.
2.) How to use Boolean value in Filter?
3.) Filter the criteria based on multiple columns.
4.) Filter the multiple cells in single column or multiple column.
5.) Understanding the logical operators in filters.
6.) How to apply nested criteria in filter?
7.) Apply the filter using ~ (tild) operator.
8.) Filter with string data.
9.) Apply the filter using isin method.
10.) How to use Lambda within the filter?
11.) Filter with Query method, nlargest, nsmallest and loc.
12.) Examples....
Jupyter Notebook: github.com/Abh...
DataSet: github.com/Abh...
Python Teaser: • A Beautiful Python Pro...
Python Pandas Tutorial: • Python Pandas Tutorial...
Python Playlist: • Python Tutorial for Be...
Python Data Structure Playlist: • Python Data Structure
Python OOPs Playlist: • Object Oriented Progra...
Python Excel Automation: • Excel Automation Using...

Пікірлер: 35
@mosama22
@mosama22 11 ай бұрын
Thank you 😊 So to Sum up, we can filter data in pandas through: - Boolean Mask, - loc (and unnecessarily iloc), - query(), - lambda, - isnull, and which you discussed in detail in the next video, Thx body 🙂 🙂
@vimalchawla6740
@vimalchawla6740 Жыл бұрын
>700 and =
@dss1871
@dss1871 3 жыл бұрын
Thanks Sir 😊😊 very informative session..👍👍👍👍
@ProgrammingIsFunn
@ProgrammingIsFunn 3 жыл бұрын
I am happy, its useful for you.
@hanumantgavali8543
@hanumantgavali8543 2 жыл бұрын
hey bro thank you, you did it as ur channel name...!!
@ProgrammingIsFunn
@ProgrammingIsFunn 2 жыл бұрын
Thanks Hanumant..... 😊
@Avdheshkumar-kd9qz
@Avdheshkumar-kd9qz 3 жыл бұрын
awesome content with nice explanation !! thx !!
@ProgrammingIsFunn
@ProgrammingIsFunn 3 жыл бұрын
Glad you liked it!
@raymundofelipeolvera5594
@raymundofelipeolvera5594 Жыл бұрын
In the lambda df{df.apply(lambda x :x["City"] =="Houston" and x["Category"] == "Technology", axis = 1)] how can I add one more value to Category (x["Category"] == "Technology" and "Office Supplies, axis = 1] for example? Similar that the example that you show on excel filtering multiple values in two different columns
@chint4383
@chint4383 2 жыл бұрын
I am facing problems to merge two dataframe will you hepe ???
@GrowCube-z8z
@GrowCube-z8z 4 ай бұрын
Can u please show how to folder based on OrderDate
@GrowthMindset_J
@GrowthMindset_J 2 жыл бұрын
I have multiple conditions to validate. if ‘Country’ column has specific value and ‘Age’ column is less than 11 or ‘DOB’ column has date after 2010 or ‘Comments’ column contains few different strings from a list and create a new column that prints value ‘Valid’ if all conditions meet else prints ‘Invalid’. Need to define a function and apply to multiple data frames. I’m so lost
@ProgrammingIsFunn
@ProgrammingIsFunn 2 жыл бұрын
Thanks for you comment. First of all try to apply filter on country , age and DOB column right, it is easy, and I explained in the video, after that you can go for other condition with the same logic.
@Moksha_Rahasyam
@Moksha_Rahasyam Жыл бұрын
thank you very much
@daljeetghag3321
@daljeetghag3321 5 ай бұрын
This was amazing
@vimalchawla6740
@vimalchawla6740 Жыл бұрын
Where are the sample files you use in your examples?
@ProgrammingIsFunn
@ProgrammingIsFunn Жыл бұрын
Vimal, it is mentioned in the description of video. And I am sharing here also. DataSet: github.com/AbhisheakSaraswat/RawData/blob/main/Superstore.xls
@bijaynayak6473
@bijaynayak6473 3 жыл бұрын
Very nice explained
@visasimbu
@visasimbu Жыл бұрын
date was stored in string format in dataframe. I am struggling on Converting string to date and filtering
@ProgrammingIsFunn
@ProgrammingIsFunn Жыл бұрын
Hi, if the date is stored in string format then try to convert using pd.to_datetime or you can use datetime index and strptime method to convert string in date time object
@visasimbu
@visasimbu Жыл бұрын
@@ProgrammingIsFunn so sweet of you. I have got answer under this video. You have replied for some one else. Thanks
@ramaisgod
@ramaisgod 3 жыл бұрын
Wow.. Very beautifully explained... Now my data filter concept is clear...
@abhisheksaraswat6753
@abhisheksaraswat6753 3 жыл бұрын
Great 👌
@jitendratrivedi7889
@jitendratrivedi7889 2 жыл бұрын
Very informative and too much information in one video , keep posting videos
@marvhan888
@marvhan888 Жыл бұрын
this is very nice video. Thank you so much
@mcquezchima6402
@mcquezchima6402 3 жыл бұрын
How to filter by date
@ProgrammingIsFunn
@ProgrammingIsFunn 3 жыл бұрын
df[df['Column Name'] == 'YourDate'] see below example:- df[df['Order Date'] == '2016-11-08']
@mcquezchima6402
@mcquezchima6402 3 жыл бұрын
@@ProgrammingIsFunn thanks and nice content. I have a file with data's from 2008 to 2012 but I just want to select data for 2010 how do I go about it
@ProgrammingIsFunn
@ProgrammingIsFunn 3 жыл бұрын
@@mcquezchima6402 Thanks. We can apply filter by couple of ways: 1.) df1["Order Date"] = pd.to_datetime(df['Order Date']) df[df1['Order Date'].dt.year == 2008] 2.) df[df['Order Date'].str.contains('2008')] Try and let me know.
@mcquezchima6402
@mcquezchima6402 3 жыл бұрын
@@ProgrammingIsFunn first one worked out thanks
@visasimbu
@visasimbu Жыл бұрын
@@ProgrammingIsFunn awesome. case1 worked for me.
@vloggergargfamily
@vloggergargfamily 3 жыл бұрын
Thanku sir for such kind of information that you are provinding through your vedios
@funwithfamily6906
@funwithfamily6906 3 жыл бұрын
So declarative vedio thanks ...sir
@chetanpatil2510
@chetanpatil2510 2 жыл бұрын
very well explain thanx
Python Pandas Tutorial: Pandas Apply Function and Vectorization #15
13:37
Programming Is Fun
Рет қаралды 4,1 М.
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 12 МЛН
Watermelon magic box! #shorts by Leisi Crazy
00:20
Leisi Crazy
Рет қаралды 36 МЛН
Как подписать? 😂 #shorts
00:10
Денис Кукояка
Рет қаралды 8 МЛН
Python Pandas Tutorial: Pandas Concat and Append Method #12
16:05
Programming Is Fun
Рет қаралды 8 М.
Python Pandas Tutorial: Pandas iloc and loc #8
15:49
Programming Is Fun
Рет қаралды 10 М.
Pandas Query Filter Function Guide [Beginner Friendly]
14:46
Ryan & Matt Data Science
Рет қаралды 3,8 М.
How to filter a pandas DataFrame | 6 HELPFUL METHODS
17:27
Chart Explorers
Рет қаралды 30 М.
How do I select multiple rows and columns from a pandas DataFrame?
21:47
Python Pandas Tutorial : Importing Data with Pandas#3
12:23
Programming Is Fun
Рет қаралды 8 М.
How to use the Pandas GroupBy function | Pandas tutorial
19:03
Mısra Turp
Рет қаралды 30 М.