-
Notifications
You must be signed in to change notification settings - Fork 893
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
Feat/slice intersect multi series #2592
base: master
Are you sure you want to change the base?
Feat/slice intersect multi series #2592
Conversation
0ae1729
to
b6f6812
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2592 +/- ##
==========================================
- Coverage 94.14% 94.10% -0.05%
==========================================
Files 139 139
Lines 14884 15003 +119
==========================================
+ Hits 14013 14119 +106
- Misses 871 884 +13 ☔ View full report in Codecov by Sentry. |
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 for this PR @ymatzkevich, it looks really good already 🚀
Just had some minor suggestions here and there. After that we can merge
…s' into feat/slice_intersect_multi_series
In order to test the efficiency of the new logic, I performed a test (removed from the unit testing because of numerical costs) of intersecting a large number of TimeSeries. For example, something like: |
Checklist before merging this PR:
Fixes #2042.
Summary
The function
TimeSeries.slice_intersect()
(see documentation) allows to intersect aTimeSeries
with another one so that they end up with the same time indices. However, if one wants to intersect multiple series, that function would need to be called several times or the intersection would need to be done by hand using e.g.xarray
. The new functionslice_intersect()
introduced with this PR solves this issue for an arbitrary number ofTimeSeries
.Essentially, given a list of
TimeSeries
having the same time index type,slice_intersect()
will output the aligned list meaning that allTimeSeries
in it will have the same start and end time (if the intersection exists).Other Information
If the given
TimeSeries
do not have all the same time index type (e.g. some have aRangeIndex
and someDateTimeIndex
), the function will raise an error.