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.
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
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