Primary competition visual

Mtoto News Childline Kenya Call Volume Prediction Challenge

Helping Kenya
2000 Zindi Points
Challenge completed ~6 years ago
Forecast
264 joined
37 active
Starti
Apr 11, 19
Closei
Aug 04, 19
Reveali
Aug 05, 19
Some help for a beginner.
Data · 18 May 2019, 18:42 · 3

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?

Discussion 3 answers

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/

20 May 2019, 16:36
Upvotes 0

Thanks. This is the method I used.

User avatar
Limos-université clermont auvergne

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.

22 May 2019, 13:32
Upvotes 0