Skip to content
Advertisement

Check if value of dataframe is existing in list

I am trying to split a pandas Dataframe into two, based on the value in the column “country”.

If the value exists in the following list (EU-COUNTRY-CODES), the row should be added to a dataframe called “EU”, if it does not exist in the list I want to add the row to another dataframe.

JavaScript

I tried to do it this way but got following Error:

JavaScript

Advertisement

Answer

try this:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement