Skip to content

CLN: Delay converting bins to datetimelike until necessary #21724

New issue

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

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

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/reshape/tile.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def cut(x, bins, right=True, labels=None, retbins=False, precision=3,
duplicates=duplicates)

return _postprocess_for_cut(fac, bins, retbins, x_is_series,
series_index, name)
series_index, name, dtype)


def qcut(x, q, labels=None, retbins=False, precision=3, duplicates='raise'):
Expand Down Expand Up @@ -307,7 +307,7 @@ def qcut(x, q, labels=None, retbins=False, precision=3, duplicates='raise'):
dtype=dtype, duplicates=duplicates)

return _postprocess_for_cut(fac, bins, retbins, x_is_series,
series_index, name)
series_index, name, dtype)


def _bins_to_cuts(x, bins, right=True, labels=None,
Expand Down Expand Up @@ -365,8 +365,6 @@ def _bins_to_cuts(x, bins, right=True, labels=None,
result = result.astype(np.float64)
np.putmask(result, na_mask, np.nan)

bins = _convert_bin_to_datelike_type(bins, dtype)

return result, bins


Expand Down Expand Up @@ -511,7 +509,7 @@ def _preprocess_for_cut(x):


def _postprocess_for_cut(fac, bins, retbins, x_is_series,
series_index, name):
series_index, name, dtype):
"""
handles post processing for the cut method where
we combine the index information if the originally passed
Expand All @@ -523,6 +521,8 @@ def _postprocess_for_cut(fac, bins, retbins, x_is_series,
if not retbins:
return fac

bins = _convert_bin_to_datelike_type(bins, dtype)

return fac, bins


Expand Down