I would like to remove rows from a dataframe, whose values do not exist in a list.
I have tried this code, however it does not work as I want it to:
status_list = ['Selected for Development', 'Selected for Development', 'Finalizada', 'Backlog', 'Backlog', 'Backlog', 'En curso', 'Finalizada', 'Selected for Development']
for row in changelog_df['changelog.status.to']:
if row != status_list:
changelog_df.drop(changelog_df.index[changelog_df['changelog.status.to'] == row], inplace=True)
In short, I would like to delete these rows:
Is it possible?
Thank you in advance.