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

add function to rename cols #8

Open
behrica opened this issue Sep 17, 2017 · 2 comments
Open

add function to rename cols #8

behrica opened this issue Sep 17, 2017 · 2 comments

Comments

@behrica
Copy link

behrica commented Sep 17, 2017

I implemented it for me like this:

(defn rename-cols [renames df]
   (map #(clojure.set/rename-keys % renames) df)
  )

It is a rather trivial function, so I am not sure if you want to have it in huri.core.

If you are interested, I could make a PR

@sbelak
Copy link
Owner

sbelak commented Sep 18, 2017

Out of curiosity, what's the use case for renaming? I've never felt the need, but if I had to whip up something I'd probably use derive-cols with identity. Not categorically against including this, just want to understand the use cases better to see how widely applicable it is.

@behrica
Copy link
Author

behrica commented Sep 18, 2017

I read my tables from csvs/excel and sometimes the column names are too ugyl..
Or I want to join, and need to make the join column the same name.

"derive" alone would not do it, as it needed 'derive' to make a copy and "select-cols" to remove the old one.

I am used to dplyr... so look for "similar" functions.

but indeed, rename coul be implemented by using derive + select. (to remove the former one)

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