简体   繁体   中英

Select 2 types of rows from dataframe python

在此处输入图片说明

I want to select rows in the data frame with New state == 'Granted' | 'Pending promotion'New state == 'Granted' | 'Pending promotion'

How can I do this in python?

I know it may be simple but not able to find anything online! Here's what I tried.

data=data.loc[(data['New state']=='Pending Promotion') & (data['New state']=='Granted')]

But gives an empty dataframe

试试这个:

data = data[data["New state"].isin(["Pending Promotion","Granted"])]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM