-
Notifications
You must be signed in to change notification settings - Fork 81
Add is_weekend column to DateFlagsTransform #101
Conversation
def _get_weekends(timestamp_series: pd.Series) -> np.array: | ||
"""Generate an array with the weekends flags.""" | ||
weekend_days = (5, 6) | ||
return timestamp_series.apply(lambda x: x.weekday() in weekend_days).values |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use something like this instead of apply?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use it to obtain the day number in week here x.weekday()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pandas doesn't have a special method for weekends
Codecov Report
@@ Coverage Diff @@
## master #101 +/- ##
==========================================
+ Coverage 87.71% 87.74% +0.03%
==========================================
Files 54 54
Lines 2466 2473 +7
==========================================
+ Hits 2163 2170 +7
Misses 303 303
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
IMPORTANT: Please do not create a Pull Request without creating an issue first.
Before submitting (must do checklist)
Type of Change
Proposed Changes
Add 'is_weekend' feature in DateFlagsTransform
Related Issue
Closing issues
closes #68