Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Updated infer_dtype docstring #61092

Closed
wants to merge 5 commits into from

Conversation

gm-oo9
Copy link

@gm-oo9 gm-oo9 commented Mar 10, 2025

@gm-oo9 gm-oo9 requested a review from WillAyd as a code owner March 10, 2025 00:24
swt2c and others added 4 commits March 10, 2025 07:48
)

* BUG: Fix OverflowError in lib.maybe_indices_to_slice()

This fixes this error when slicing massive dataframes:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/frame.py", line 4093, in __getitem__
    return self._getitem_bool_array(key)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/frame.py", line 4155, in _getitem_bool_array
    return self._take_with_is_copy(indexer, axis=0)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/generic.py", line 4153, in _take_with_is_copy
    result = self.take(indices=indices, axis=axis)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/generic.py", line 4133, in take
    new_data = self._mgr.take(
               ^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/internals/managers.py", line 893, in take
    new_labels = self.axes[axis].take(indexer)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/anaconda3/lib/python3.12/site-packages/pandas/core/indexes/datetimelike.py", line 839, in take
    maybe_slice = lib.maybe_indices_to_slice(indices, len(self))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "lib.pyx", line 522, in pandas._libs.lib.maybe_indices_to_slice
OverflowError: value too large to convert to int

* Sort whatsnew entries

* Set type hint back to int

---------

Co-authored-by: benjamindonnachie <83379521+benjamindonnachie@users.noreply.github.com>
@gm-oo9 gm-oo9 requested a review from MarcoGorelli as a code owner March 10, 2025 02:24
@gm-oo9
Copy link
Author

gm-oo9 commented Mar 12, 2025

Closing this PR in favor of #61111 because it contains only the necessary changes with a clean commit history. Apologies for the confusion!

@gm-oo9 gm-oo9 closed this Mar 12, 2025
@gm-oo9 gm-oo9 deleted the update-infer_dtype-docstring branch March 12, 2025 09:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: pd.api.types.infer_dtype on scalar input
3 participants