Garve / scikit-bonus

scikit-learn extensions that I find useful.
BSD 3-Clause "New" or "Revised" License
12 stars 2 forks source link

SimpleTimeFeatures? #5

Closed benman1 closed 3 years ago

benman1 commented 3 years ago

Hi This looks great. I see you have lots of very cool functionality implemented. Could you push the SimpleTimeFeatures, please? I assume it would go into skbonus.preprocessing.time?

Thanks!

Garve commented 3 years ago

Heya!

Happy that you find it useful! :) I refactored everything and didn't update the readme so far. I made a function out of it since it doesn't make much sense to have a transformer with a fit and transform function.

You can find it here: https://github.com/Garve/scikit-bonus/blob/master/skbonus/pandas/time_utils.py

And you can use it like this:

from skbonus.pandas.time_utils import add_time_features

df = pd.read_csv(...)

add_time_features(df, hour=True) #or also like df.pipe(add_time_features, hour=True)

Hope this helps!

Best Robert

benman1 commented 3 years ago

Thanks for explaining. Makes sense about the refactoring etc. I had actually seen the function, and what it does. The function is good obviously, but - call me a purist or pedantic - I still think a transformer actually makes sense for this to bundle everything together, and save and load the pipeline.