Skip to content

CLN: Break up wrap applied output #36536

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
Sep 22, 2020

Conversation

rhshadrach
Copy link
Member

Splitting off the Series case seemed to be a natural way to break up this method. Always open to other thoughts.

@rhshadrach rhshadrach added Apply Apply, Aggregate, Transform, Map Clean Groupby labels Sep 21, 2020
Copy link
Member

@arw2019 arw2019 left a comment

Choose a reason for hiding this comment

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

+1

For me this makes _wrap_applied_output easier to follow

@jbrockmendel
Copy link
Member

can you merge master and ill take a look

@rhshadrach
Copy link
Member Author

@jbrockmendel Merged and passing thus far. Much of the diff is due to indentation being one level less, easier to view if you ignore whitespace.

keys,
values: List[Series],
not_indexed_same: bool,
first_not_none,
Copy link
Contributor

Choose a reason for hiding this comment

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

ideally if you can type the args (certainly can be a followon)

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 was thinking this too, but wasn't certain of types. We can't rely on mypy to catch improper typing here because this is being called from untyped code. I can guess at types and run tests with assert isinstance(var, guess) to confirm the guess, and rely on good test coverage. Is that an appropriate way to approach here?

Copy link
Contributor

Choose a reason for hiding this comment

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

sure u can try that
ultimately we want to type all the way up and have mypy validate - but of course takes time and effort to get there

keys, values, not_indexed_same=not_indexed_same
)
# values are Series
return self._wrap_applied_output_series(
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't L1198 and L1207 also a series?

Copy link
Member Author

@rhshadrach rhshadrach Sep 22, 2020

Choose a reason for hiding this comment

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

L1198 values is a list of either ndarrays or Index; L1207 values is a list of scalars.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok i c, can you make these clear in comments (followon ok).

@jreback jreback added this to the 1.2 milestone Sep 22, 2020
@jreback jreback merged commit 5b5cfb2 into pandas-dev:master Sep 22, 2020
@rhshadrach rhshadrach deleted the breakup_wrap_applied_output branch October 11, 2020 13:22
kesmit13 pushed a commit to kesmit13/pandas that referenced this pull request Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Apply Apply, Aggregate, Transform, Map Clean Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants