Answers for "two conditions in dataframe pandas"

5

how to slicing dataframe using two conditions

# when you wrap conditions in parantheses, you give order
# you do those in brackets first before 'and'
# AND
movies[(movies.duration >= 200) & (movies.genre == 'Drama')]
Posted by: Guest on March-21-2020
4

or condition in pandas

df2 = df[(df.a != -1) | (df.b != -1)]
Posted by: Guest on June-03-2020
1

python multiple conditions in dataframe column values

df.loc[(df['Salary_in_1000']>=100) & (df['Age']< 60) & (df['FT_Team'].str.startswith('S')),['Name','FT_Team']]
Posted by: Guest on August-25-2021
0

mutiple condition in dataframe

df[(df['Salary_in_1000']>=100) & (df['Age']<60) & df['FT_Team'].str.startswith('S')][['Name','Age','Salary_in_1000']]
Posted by: Guest on October-03-2021

Code answers related to "two conditions in dataframe pandas"

Python Answers by Framework

Browse Popular Code Answers by Language