-
Notifications
You must be signed in to change notification settings - Fork 33
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
Allow tz-aware timstamps in gaps.trim
#206
Conversation
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.
Thanks @qnguyen345 for the PR! One question below.
pvanalytics/quality/gaps.py
Outdated
mask.loc[start.date():end.date()] = True | ||
mask.loc[pd.to_datetime(start.date()).tz_localize(series.index.tz): | ||
pd.to_datetime(end.date()).tz_localize(series.index.tz)] = \ | ||
True |
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.
The return values of start_stop_dates
seem to always have timestamps at midnight. With that in mind, do we need to do any conversion like .date()
here? Couldn't we just use start
and end
as-is?
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.
You are right mask.loc[start:end] = True would also works since adding .date() would change start and end from tz-aware to tz-naive, which made the Pandas error. I edited the code and have pushed your suggestion.
5d9c77a
to
9843d51
Compare
@kandersolar we went through all of the examples and the QA notebooks and this was the only function throwing a pandas error (data shifts module didn't have issues). When this is merged in, we should be good to go with pandas>=2.0.0 |
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.
Thanks @qnguyen345!
Updated quality.gaps.trim function for updated versions of Pandas 2.0
docs/api.rst
.in
docs/whatsnew
for all changes. Includes link to the GitHub Issue with
:issue:`num`
or this Pull Request with
:pull:`num`
. Includes contributor nameand/or GitHub username (link with
:ghuser:`user`
).