Skip to content

Conversation

Vishnu-sai-teja
Copy link

Fix IndexError in crosstab with aggfunc=‘skew’.

  • Check if table is empty before accessing last row in _normalize function in pandas/core/reshape/pivot.py.
  • Skip normalization and return empty table if it is.
  • Add test case in pandas/tests/reshape/test_crosstab.py for aggfunc=‘skew’.
  • Ensure test case doesn’t raise IndexError.

Fix `IndexError` in `crosstab` with `aggfunc=‘skew’`.

* Check if table is empty before accessing last row in `_normalize` function in `pandas/core/reshape/pivot.py`.
* Skip normalization and return empty table if it is.
* Add test case in `pandas/tests/reshape/test_crosstab.py` for `aggfunc=‘skew’`.
* Ensure test case doesn’t raise `IndexError`.
@mroeschke
Copy link
Member

Thanks for the pull request, but it appears to have gone stale. If interested in continuing, please merge in the main branch, address any review comments and/or failing tests, and we can reopen.

@mroeschke mroeschke closed this Mar 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.

2 participants