feat: Add six new Series methods - #21
Conversation
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.
|
👋 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 For security, I will only act on instructions from the user who triggered this task. |
| 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] |
There was a problem hiding this comment.
@google-jules-bot Please remove session from the DataFrame and Series constructors. For describe, please return a pandas Series rather than a leanframe Series.
There was a problem hiding this comment.
I have removed session from the DataFrame and Series constructors and updated describe to return a pandas Series.
This commit implements six new methods for the
Seriesclass, as requested inspecs/2025-09-16-series-methods.md. It also includes a refactoring of theSeriesandDataFrameclasses to support the implementation of thedescribemethod.PR created automatically by Jules for task 10287785780693748555