Skip to content
Advertisement

How to split in train and test by month

I have a dataframe structured like this

JavaScript

I have data for all days and months from 2018 to 2021, with around 50k observations

How can I aggregate all the data for the same month and perform a Train-Test splitting for each month? I.e. for all the data of the months of January, February, March and so on.

Advertisement

Answer

try this:

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