Skip to content

feat: Add six new Series methods - #21

Closed
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
feat-add-series-methods
Closed

feat: Add six new Series methods#21
google-labs-jules[bot] wants to merge 1 commit into
mainfrom
feat-add-series-methods

Conversation

@google-labs-jules

Copy link
Copy Markdown
Contributor

This commit implements six new methods for the Series class, as requested in specs/2025-09-16-series-methods.md. It also includes a refactoring of the Series and DataFrame classes to support the implementation of the describe method.


PR created automatically by Jules for task 10287785780693748555

This commit implements the following six methods for the `Series` class:
- `cummax`
- `cummin`
- `cumprod`
- `cumsum`
- `describe`
- `diff`

To support the implementation of the `describe` method, this commit also refactors the `Series` and `DataFrame` classes to include a `session` object. This allows for the creation of new `DataFrame` objects from within the `Series` class.
@google-labs-jules

Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

@tswast
tswast marked this pull request as ready for review November 3, 2025 15:28
Comment thread leanframe/core/series.py
Comment on lines +199 to +215
def describe(self) -> "Series":
"""Return a Series with descriptive statistics."""
stats = {
"count": self.count(),
"mean": self.mean(),
"std": self.std(),
"min": self.min(),
"25%": self._data.quantile(0.25).to_pyarrow().as_py(),
"50%": self._data.quantile(0.50).to_pyarrow().as_py(),
"75%": self._data.quantile(0.75).to_pyarrow().as_py(),
"max": self.max(),
}

index = ["count", "mean", "std", "min", "25%", "50%", "75%", "max"]
pandas_series = pd.Series(stats, name=self.name, index=index)

return self._session.DataFrame(pandas_series.to_frame())[self.name]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@google-jules-bot Please remove session from the DataFrame and Series constructors. For describe, please return a pandas Series rather than a leanframe Series.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I have removed session from the DataFrame and Series constructors and updated describe to return a pandas Series.

@tswast tswast closed this Nov 10, 2025
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.

1 participant