Skip to content
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

combine columns stringwise #45

Open
bjpop opened this issue Sep 19, 2022 · 0 comments
Open

combine columns stringwise #45

bjpop opened this issue Sep 19, 2022 · 0 comments

Comments

@bjpop
Copy link
Owner

bjpop commented Sep 19, 2022

It can be useful to combine columns as (if they were) strings.

embark_town,class,size
Cherbourg,First,85
Cherbourg,Second,17
Cherbourg,Third,66
Queenstown,First,2
Queenstown,Second,3
Queenstown,Third,72
Southampton,First,127
Southampton,Second,164
Southampton,Third,353

For example it would be useful to be able to combine embark_town and class into a single column by concatenating their values together as strings.

This ought to be possible with eval, but currently eval doesn't seem to work with strings when using +.

There is an open ticket for this: pandas-dev/pandas#47734

We could wait for that bug to be fixed, or we could consider having a combine operation.

Sometimes it would be useful to be able to combine columns and throw away the originals, other times it might be useful to keep the originals as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant