8000 CLN/ERR: str.cat internals by h-vetinari · Pull Request #22725 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

CLN/ERR: str.cat internals #22725

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 9 commits into from
Oct 14, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add comment
  • Loading branch information
h-vetinari committed Oct 11, 2018
commit ed27c663681f2e0112109d74f8d450eb56218601
1 change: 1 addition & 0 deletions pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2245,6 +2245,7 @@ def cat(self, others=None, sep=None, na_rep=None, join=None):
# if join is None, _get_series_list already aligned indexes
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps as a follow up but if the alignment behavior is going to be scattered across these two methods would probably make more sense as a dedicated private method which can be called rather than having various arguments trigger the behavior in various functions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You've got a point, and actually that line is not necessary anymore after I introduced the if any(...) condition right below.

Just as a comment about doing things in different places: _get_series_list will transform everything without an index (i.e. lists/ndarray/iterators) into Series which inherit the index of the caller. This is a necessary step to be able to talk about alignment of indexes at all (second step).

join = 'left' if join is None else join

# align if required
if any(not data.index.equals(x.index) for x in others):
# Need to add keys for uniqueness in case of duplicate columns
others = concat(others, axis=1,
Expand Down
0