Hello everyone, I'd like to know how do I convert the date column values to be formed in the way that it is seen in the sample submission CSV?
In the train.csv df['calldate'] is written as: 2016-01-01 07:26:47 but in the sample submission csv the same is represented as: 2016071300. How do I achieve this conversion?
Hi Tim you need to first parse the field as a date then using something like apply and lambda functions and datetime.strftime() convert it to desireable format example:
df['calldate'].apply(lambda x: datetime.strftime(x, "%Y%m%d%H%M%S")
This assumes you have already parsed the column as a datetime value/feature.
Visit this page to learn the different date formats: http://strftime.org/
Thanks. This is the method I used.
Hi Tim,
You don't have to do any convertion unless your models use this kind of format! Keep the date format when training your model, and just set the "calls" column of the submission file and save it. This is what I did.