Working with dates
Working with dates is rarely straightforward. Data analysts need to successfully parse date values, identify invalid or out-of-range dates, impute dates when they’re missing, and calculate time intervals. There are surprising hurdles at each of these steps, but we are halfway there once we’ve parsed the date value and have a datetime value in pandas. We will start by parsing date values in this recipe before working our way through the other challenges.
Getting ready
We will work with the NLS and COVID-19 case daily data in this recipe. The COVID-19 daily data contains one row for each reporting day for each country. (The NLS data was actually a little too clean for this purpose. To illustrate working with missing date values, I set one of the values for birth month to missing.)
Data note
Our World in Data provides COVID-19 public use data at https://ourworldindata.org/covid-cases. The data used in this recipe was downloaded...