3

I have a dataframe with more than 1000 rows, and three columns with different values (integers). I would like to select rows, in which the values of three columns are within 2-folds or less of each other. I have tried this:

df = df[(df['B'] >  | < | == 2 * df['D']) & (df['B'] > | < | == 2 * df['F'])] 

which it did not work! I am new to Pandas.

1 Answer 1

2

Looks like you might want to try:

df = df[((df.B>df.D) & (df.B<df.D*2)) & ((df.B>df.F) & (df.B<df.F*2))]
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.