Skip to content

REF: document casting behavior in groupby #41376

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 3 commits into from
May 17, 2021

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • Ensure all linting tests pass, see here for how to run them
  • whatsnew entry

@@ -1236,12 +1233,11 @@ def _wrap_applied_output_series(
columns = key_index
stacked_values = stacked_values.T

if stacked_values.dtype == object:
# We'll have the DataFrame constructor do inference
stacked_values = stacked_values.tolist()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any perf impact by passing a list to DataFrame constructor?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_apply_numeric_coercion_when_datetime goes through here. running the usage in timeit looks like a wash

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we may be able to do better/cleaner following #40489

@rhshadrach rhshadrach added the Dtype Conversions Unexpected or buggy dtype conversions label May 8, 2021
@rhshadrach rhshadrach added this to the 1.3 milestone May 8, 2021
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also pls rebase

@@ -967,11 +967,22 @@ def _cython_operation(
)

@final
def agg_series(self, obj: Series, func: F) -> ArrayLike:
def agg_series(self, obj: Series, func: F, preserve: bool = False) -> ArrayLike:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preserve_dtype? I don't know if we use this keyword elsewhere

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or cast?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changing to preserve_dtype

@jreback
Copy link
Contributor

jreback commented May 17, 2021

and perf question

@jbrockmendel
Copy link
Member Author

updated + green

@jreback jreback merged commit 60f5d8b into pandas-dev:master May 17, 2021
@jbrockmendel jbrockmendel deleted the ref-cast_back-2 branch May 17, 2021 19:25
TLouf pushed a commit to TLouf/pandas that referenced this pull request Jun 1, 2021
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants