Answers for "dataframe query and condition"

5

or condition in pandas

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

create the dataframe column based on condition

df.loc[df['column name'] condition, 'new column name'] = 'value if condition is met'
Posted by: Guest on May-10-2020

Code answers related to "dataframe query and condition"

Python Answers by Framework

Browse Popular Code Answers by Language