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

Positional naming/renaming of dataset columns #262

Closed
respatialized opened this issue Aug 11, 2021 · 2 comments
Closed

Positional naming/renaming of dataset columns #262

respatialized opened this issue Aug 11, 2021 · 2 comments

Comments

@respatialized
Copy link
Contributor

I was working with a dataset that had repeated column names and the existing map-based methods made it tricky to rename the columns to avoid the duplicates. I was thinking that positional assignment of column names might be both a solution to this particular problem and a more generally useful capability for tech.ml.dataset. On Zulip, it was suggested that I open an issue here about this.

If possible, I'd like to work up a PR for this. It could either be a new function name-columns, or an extension to rename-columns that behaves differently if a vector is passed in. I have no opinion one way or another about which is preferable.

@cnuernber
Copy link
Collaborator

Both are good options - I would like to stick with rename-columns to avoid another symbol. If we go with a vector approach the only requirement I see is that the vector must be complete - it must have a name for every column. This is not currently true for the map approach.

cnuernber pushed a commit that referenced this issue Aug 14, 2021
* Initial implementation of positional rename

This adds a test to replicate the case of a CSV file with multiple
columns that have the same name (but different values). It only tests
the successful case, not the error case.

* Add ex-info and tests for incorrect rename args
@cnuernber
Copy link
Collaborator

Fixed by #264

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