I'm trying to write a Python code using Pandas to filter out a CSV file, dependent on conditions set from another CSV file.
The CSV I want to filter looks something like this:
date product
01/05/2020 Test Product 1
02/05/2020 Test Product 1
03/05/2020 Test Product 1
04/05/2020 Test Product 1
05/05/2020 Test Product 1
06/05/2020 Test Product 1
07/05/2020 Test Product 1
01/05/2020 Test Product 2
02/05/2020 Test Product 2
03/05/2020 Test Product 2
04/05/2020 Test Product 2
05/05/2020 Test Product 2
06/05/2020 Test Product 2
07/05/2020 Test Product 2
And the CSV with the condition something like this:
product start_date
Test Product 1 01/05/2020
Test Product 2 04/05/2020
What I'm looking to do, is filter the first CSV so that any Test Product that has a start_date after 01/05, will have the relevant rows deleted. For example, Test Product 2 has start_date 04/05/2020, which means in the first CSV i'm trying to delete the rows for 01/05, 02/05 and 03/05 for that product.
This would be the desired output:
date product
01/05/2020 Test Product 1
02/05/2020 Test Product 1
03/05/2020 Test Product 1
04/05/2020 Test Product 1
05/05/2020 Test Product 1
06/05/2020 Test Product 1
07/05/2020 Test Product 1
04/05/2020 Test Product 2
05/05/2020 Test Product 2
06/05/2020 Test Product 2
07/05/2020 Test Product 2
What's the best way to do this? I've been trying to do it with so many ways using dataframes for a long time, but haven't reached any correct script...
Many thanks in advance!