Skip to content
Advertisement

Convert a list of strings in pandas into a list of date, and filter the value accordingly

Now I have a dataframe similar as follows

JavaScript

What I am trying to do is to

  • Convert all the values in the list to date
  • Filter the value which are only later than 2018-01-01

In the first step, what I tried to do is to use a apply function so that I can cover all elements in the list:

JavaScript

However, the result was like this

JavaScript

How should I fix it? Thank you for your help!

Advertisement

Answer

Add return for avoid missing values and filter greater values in boolean indexing:

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