feature_engine icon indicating copy to clipboard operation
feature_engine copied to clipboard

New transformer to substract datetime variables, that is support timestamp subtraction

Open kylegilde opened this issue 3 years ago • 6 comments

Is there any chance that you would support the ability to subtract datetime columns?

kylegilde avatar Nov 29 '21 20:11 kylegilde

We do want to expand the functionality of Feature-engine to work with datetime variables. See for example #67. I think that would be the first step. And then we can see how to best implement datetime combinations.

I am inclined to have separate transformers to handle datetime variables. Otherwise, the transformers become too complicated.

We are a bit short of hands. So if you fancy helping us expand the library, that would be great.

solegalli avatar Nov 29 '21 22:11 solegalli

I think it does make sense to have datetime transformers in its own module. I'll give #67 a look. Thanks!

kylegilde avatar Nov 29 '21 22:11 kylegilde

I see that the datetime module was released today. If we wanted to proceed with a datetime subtraction class, would we just need to combine some parts of the DatetimeFeatures class w/ most of what's in the CombineWithReferenceFeature class? One additional argument would need to be output_units perhaps? Or just hardcode it to be fractions of a day?

kylegilde avatar Jan 05 '22 00:01 kylegilde

What you say sounds right. I would have an output units argument as well. some differences might be in seconds, so fractions of the day might not be very useful.

Would you like to give it a go?

solegalli avatar Jan 05 '22 00:01 solegalli

I might give it a go if I have some time this week/weekend.

kylegilde avatar Jan 05 '22 01:01 kylegilde

should I create a datetime_subtraction.py script in the datetime folder?

kylegilde avatar Jan 07 '22 22:01 kylegilde