Selecting Rows in Pandas DataFrame Based on Conditions | GeeksforGeeks

Selecting Rows in Pandas DataFrame Based on Conditions | GeeksforGeeks

GeeksforGeeks

3 года назад

29,168 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Jesse
Jesse - 09.11.2023 16:59

Why use .loc when we get the same results just using df[df[? That's something I can't quite understand. Thank you for the video. Concise and informative.

Ответить
Brian Rice
Brian Rice - 01.07.2023 05:32

isin method was super helpful, thanks guys

Ответить
Kenneth Stephani
Kenneth Stephani - 11.04.2023 20:12

Great video!

Ответить
om muruga
om muruga - 20.03.2023 19:03

I need sale 2 person,product 5 person and Others each is 3 how to I calculate

Ответить
Piper Esguerra
Piper Esguerra - 28.02.2023 19:26

if the column is zip code / post code and I want to select the first two characters what is the code for that? for example under column post code I want to show post code that start with NG

Ответить
Adrij Roy
Adrij Roy - 23.12.2022 10:27

Also if we want to select employees who came after 10 am say, how to do it?

Ответить
Adrij Roy
Adrij Roy - 23.12.2022 10:26

The video is very informative. If we want to select rows based upon time of arrival/departure, how can we do it? Please suggest. Thanks.

Ответить
Mehar un Nisa
Mehar un Nisa - 01.12.2022 09:34

Lets suppose we get only those rows whose indexs contain 7 then what condition is for?

Ответить
Huyền Phan Thanh
Huyền Phan Thanh - 28.11.2022 06:19

thanks a lot for your useful video. I wonder that whether this selecting method can be used for searching assignment ? and I dont know how to search for a month '6' and it still shows the result comprises year,month,day.

Ответить
Trotsky
Trotsky - 25.10.2022 09:15

Thanks a lot! Very helpful

Ответить
cee jinx
cee jinx - 23.09.2022 14:23

Thanks a lot! It helped me with our assignment about Selecting Rows and you the best!

Ответить
Ankit Srivastava
Ankit Srivastava - 28.08.2022 19:12

How to know that when I choose range between slab as eg: 0 to 5 as 0
5 to 10 as 1 , 10 to 24 as 2 etc
Based on column wise ?
Scoring purpose for analysis

Ответить
nitish Bhardwaj
nitish Bhardwaj - 08.08.2022 16:54

How to. Know that Larry belongs to Business development team?

Ответить
Rishabh Sar Di
Rishabh Sar Di - 12.07.2022 19:06

m getting this Error while putting condition:
'SyntaxError: cannot assign to subscript here. Maybe you meant '==' instead of '='?'

Syntax: DF = DF22.[DF22['sub_code']=1930]

Ответить
Neville Doke
Neville Doke - 04.05.2022 09:40

for example u have 1 excel sheet and it consist of 10000 data in it. Later when we import that excel file in pycharm or jupiter notebook. if i run that file i will get an Index range also know as Row labels. my python code should be able to read that ten thousand row labels and should be able to separate / split into 10 different excel sheet files which will have 1000 data in each of the 10 saperated sheet.


other example is, if there is 9999 data in 1 sheet then my python code should divide 9000 data in 9 sheet and other 999 in other sheet without any mistakes.





i am asking this because in my data there is not any unique values for my code to split the files using .unique


plz help i have search the whole YT , stackoverflow, and github tooo from 3 days

Ответить
Pru C
Pru C - 11.04.2022 19:27

Thank you very much! This was very helpful. It looks like the basic method and the loc method do exactly the same thing!

Ответить
Dharmesh Chauhan
Dharmesh Chauhan - 07.02.2022 20:28

Hi there. Great work!
I want to know if there is a lambda function to achieve what we did in this video?
Another thing, if one wants to create a new variable from multiple conditions and also separating few columns from total of let's say 100 columns, what's the best way to do it?
for example, we have columns A to Z. And we want to sort Column B and Column C with conditions, B>0.5, and C<0.1. And at the same time create a new_df with columns A,B,C,D, E only. Is there any effective way to achieve this?

Ответить
Ali Ebrahimi
Ali Ebrahimi - 07.11.2021 00:16

thanks for the video. What about if you need to check two columns and if the value of the list isin either one?

Ответить
khoubabioki
khoubabioki - 11.10.2021 22:08

Excellent

Ответить
shorts world
shorts world - 11.06.2021 14:46

Hii

Ответить