-
Notifications
You must be signed in to change notification settings - Fork 327
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
Feature request: rename columns when selecting #173
Comments
This sounds like a possibly good idea to me. It probably should be a separate rename command. It will need some design work in terms of the syntax supported. It would ideally combine select syntax for specifying which columns to rename, for example. |
Yeah, I'm thinking something like |
A simpler version might be too just keep the same select syntax, which selects some number of columns in a particular order. Then the remaining positional arguments are the new names of the columns, where there are exactly N arguments, where N is the number of fields selected. |
Ah, yes. I can see that might work. The simple case would then just be I had a look through past issues etc., and what we're talking about here sounds a bit like the |
+1 for this feature! Definitely have had the need for this a few times. |
@BurntSushi @purcell @kacrouse I had to merge/join CSV files today, and I just stumbled upon I really needed to be able to rename columns so I tried to figure out what would be the best way to contribute a solution. I implemented what was discussed in this thread, specifically the variant suggested by @BurntSushi. Let me know if this hits the spot! |
a sql like syntax for this would be nice. So something like |
I appreciate that you don't want to support the full sql syntax. I already use csvsql (comes with csvkit), which indeed uses sqlite. My main issue with that is that it is kind of slow compared to xsv, which is awesome. The reason I proposed this |
Since
xsv
is so invaluable for splitting and reformatting big messy CSV files (thanks!), it'd be really useful to be able to rename columns whenselect
-ing them out: I deal with some crappy CSV files that have 150-character header names.At first I was thinking a special syntax for
select
might be the solution, but now I suspect arename
subcommand might be the more appropriate option. Not really up to speed with Rust dev yet, so starting off by sharing this idea for feedback.The text was updated successfully, but these errors were encountered: