Skip to content

Conversation

@Alvaro-Kothe
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

Uses group_kurt to compute the kurtosis for extended arrays. It increases performance in asv benchmark from 6 seconds to 25 milliseconds.

$ asv continuous -E virtualenv:3.13 upstream/main HEAD -b kurt --show-stderr

| Change   | Before [7bf66609] <main>   | After [a2f1de11] <perf/kurt>   |   Ratio | Benchmark (Parameter)                                                                    |
|----------|----------------------------|--------------------------------|---------|------------------------------------------------------------------------------------------|
| +        | 2.48±0.01ms                | 2.96±0.2ms                     |    1.19 | rolling.Methods.time_method('DataFrame', ('expanding', {}), 'float', 'kurt')             |
| +        | 3.14±0.01ms                | 3.67±0.4ms                     |    1.17 | rolling.Methods.time_method('DataFrame', ('rolling', {'window': 1000}), 'float', 'kurt') |
| +        | 3.71±0.4ms                 | 4.18±0.2ms                     |    1.13 | rolling.Methods.time_method('DataFrame', ('rolling', {'window': 1000}), 'int', 'kurt')   |
| +        | 2.95±0.03ms                | 3.31±0.2ms                     |    1.12 | stat_ops.FrameOps.time_op('kurt', 'float', 0)                                            |
| -        | 4.30±0.01ms                | 3.78±0.4ms                     |    0.88 | rolling.VariableWindowMethods.time_method('Series', '1d', 'float', 'kurt')               |
| -        | 6.89±0.03s                 | 25.2±3ms                       |    0    | stat_ops.FrameOps.time_op('kurt', 'Int64', 1)                                            |

@Alvaro-Kothe Alvaro-Kothe changed the title PERF: compute kurtosis using groupby method PERF: compute kurtosis for ExtensionArray using groupby method Nov 21, 2025
@mroeschke mroeschke added Performance Memory or execution speed performance Reduction Operations sum, mean, min, max, etc. Groupby labels Nov 25, 2025
@mroeschke mroeschke added this to the 3.0 milestone Nov 25, 2025
@mroeschke mroeschke merged commit 11a5e3b into pandas-dev:main Nov 25, 2025
56 checks passed
@mroeschke
Copy link
Member

Thanks @Alvaro-Kothe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Groupby Performance Memory or execution speed performance Reduction Operations sum, mean, min, max, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants