I would like to create a new pandas dataframe from an existing dataframe with only rows where specific columns values are bigger than x. For example:
df = A B C
0 1 0 2
1 2 1 3
2 3 3 0
3 4 2 5
I want to create new_df with only the rows where the values of columns B and C are bigger than 0 which means
new_df = A B C
0 2 1 3
1 4 2 5
I used the command :
new_df = df.loc[df['B'] > 0 & df['C'] > 0]
but it doesn't work
df.loc[df.B.gt(0) & df.C.gt(0), :]?