Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EncodeHolidays class - Public Holidays for certain countries #2

Open
ulf1 opened this issue Jun 18, 2019 · 2 comments
Open

EncodeHolidays class - Public Holidays for certain countries #2

ulf1 opened this issue Jun 18, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@ulf1
Copy link
Member

ulf1 commented Jun 18, 2019

output: boolean True if it's an holiday

usage

# encode all calendars
obj = EncodeHolidays(calendar='all')
Xnew = obj.transform(dates)

# encode only USA and German calendar
obj = EncodeHolidays(calendar=['us', 'de'])
Xnew = obj.transform(dates)
@ulf1 ulf1 added the enhancement New feature or request label Jun 18, 2019
@ulf1
Copy link
Member Author

ulf1 commented Sep 16, 2019

rule-based calendars, https://pypi.org/project/holidays/

@ulf1
Copy link
Member Author

ulf1 commented Sep 16, 2019

from sklearn.base import BaseEstimator, TransformerMixin
import holidays


class EncodeHolidays(BaseEstimator, TransformerMixin):
    def __init__(self, sparse=True, calendar='all'):
        self.sparse = sparse
        self.calendar = calendar
        
    def fit(self, X, y=None):
        self.column_names = ['na']
        return self 
    
    def transform(self, X, copy=None):
        return Z

@ulf1 ulf1 pinned this issue Dec 1, 2019
@ulf1 ulf1 unpinned this issue Dec 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant