Skip to content

Fix 2 tuple type annotations in TimeSeries #2812

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ajyoon
Copy link

@ajyoon ajyoon commented May 28, 2025

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses. (N/A)
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Summary

  • TimeSeries.shape was incorrectly annotated tuple[int]; this is changed to tuple[int, int, int].
  • The quantiles argument in TimeSeries.quantiles_df was incorrectly annotated tuple[float]; this is changed to tuple[float, ...].

- `TimeSeries.shape` was incorrectly annotated `tuple[int]`;
  this is changed to `tuple[int, int, int]`.
- The quantiles argument in `TimeSeries.quantiles_df` was incorrectly
  annotated `tuple[float]`; this is changed to `tuple[float, ...]`.
Copy link

codecov bot commented Jun 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.16%. Comparing base (722e645) to head (ef3ae7f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2812      +/-   ##
==========================================
- Coverage   95.24%   95.16%   -0.08%     
==========================================
  Files         145      145              
  Lines       15130    15130              
==========================================
- Hits        14410    14398      -12     
- Misses        720      732      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Collaborator

@dennisbader dennisbader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ajyoon and thanks for this this improvement 🚀 I had one small comment, after that we can merge :)

@@ -2019,7 +2019,9 @@ def quantile_timeseries(self, quantile=0.5, **kwargs) -> Self:

return self.__class__(new_xa)

def quantiles_df(self, quantiles: tuple[float] = (0.1, 0.5, 0.9)) -> pd.DataFrame:
Copy link
Collaborator

@dennisbader dennisbader Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here I think a Optional[list[float]] would actually make more sense. Could you adapt it?

E.g.

    def quantiles_df(self, quantiles: Optional[list[float]] = None) -> pd.DataFrame:
        quantiles = quantiles or [0.1, 0.5, 0.9]
        return pd.concat(
            [
                self.quantile_timeseries(quantile).to_dataframe()
                for quantile in quantiles
            ],
            axis=1,
        )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants