enter image description here

Assume I have a following dataframe which has years of experience and salary.

I would like to create a new dataframe from the existing one, only including observations where salary is above 45000. I would like it to include both columns.


One way to separate these values out of your pd dataframe is to use Pandas indexing. There are many different routes that you could go, for this, I would recommend a boolean.

new_data = pd.data[data['salary'] >= 45000] 

Should separate your data out nicely.

You can read further about this here

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.