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

clean_names breaks for MultiIndex Columns #10

Closed
JoshuaC3 opened this issue Mar 21, 2018 · 3 comments
Closed

clean_names breaks for MultiIndex Columns #10

JoshuaC3 opened this issue Mar 21, 2018 · 3 comments

Comments

@JoshuaC3
Copy link
Contributor

MultiIndex columns returns expected str not tuple type error.

If you instead used,
df.rename(columns=lambda x: x.lower().replace('_', ''))
this would work for standard and MultiIndex DataFrames.

Can do PR if required.

@ericmjl
Copy link
Member

ericmjl commented Mar 21, 2018

@JoshuaC3 definitely would be a welcome addition! Would you be kind enough to put in a PR for this, including an example and test as well?

@JoshuaC3
Copy link
Contributor Author

JoshuaC3 commented Mar 22, 2018

@ericmjl All done. Added MultiIndex tests and everything passes. Will do PR now.

FYI, I don't have the most experience with writing tests and using GitHub for PRs so please feel free to comment on anything you think I could improve on or should change.

Also, I didn't add any examples as anything using clean_names that works for the single Index DataFrame should also work for the MultiIndex.

Edit: Just seen the contributing recommendations. Flake8 told me off a lot so I will fix this and try again.

@ericmjl
Copy link
Member

ericmjl commented Mar 22, 2018

Thanks @JoshuaC3! Looking forward to the PR 😄

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

2 participants