-
Notifications
You must be signed in to change notification settings - Fork 49
Consolidate handling of datetime columns #755
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
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #755 +/- ##
==========================================
+ Coverage 95.43% 95.47% +0.04%
==========================================
Files 112 112
Lines 4379 4357 -22
==========================================
- Hits 4179 4160 -19
+ Misses 200 197 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Looks good!
I looked for all the pd.to_datetime
we're doing in the library and I'm pasting them here to decide if we should use _convert_datetime_column
in those situations:
real_data[field] = pd.to_datetime(real_data[field]) |
SDMetrics/sdmetrics/timeseries/base.py
Line 69 in f26cfc7
real_data[column] = pd.to_datetime( |
…with datetime_format fails
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.
LGTM!
|
||
# Run and Assert | ||
with pytest.raises(ValueError, match="Column 'visits' is not a valid datetime"): | ||
expected_msg = re.escape("Error converting column 'visits' to timestamp: ") |
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.
Should the actual error be included in the message?
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.
It is, but since it's a pandas error I didn't want to have the test fail if the message ever gets updated. Instead I just have the test match the initial substring we add.
Resolve #741