dataframe-js
dataframe-js copied to clipboard
[FEATURE] Allow 1 or many (not necessarily all) columns to be renamed at once.
Is your feature request related to a problem? Please describe. When we try to rename 30 columns out of a 1000 column CSV file, we are left with 2 options:
- we'll have to call df.rename 30 times, one for each column
- We'll have to loop through the 1000 columns and construct another array of columns renamed and call df.renameAll with the new array
This might also not be readable when i want to know what are the exact columns that are being renamed.
Describe the solution you'd like There can be a method say df.renameMany taking params in the format:
{ "src_column_1":"renamed_1", "src_column_2":"renamed_2", "src_column_3":"renamed_3", ... }
Describe alternatives you've considered We are currently calling df.rename multiple times for each column
Im willing to raise a PR for this
Hi @anusha5695, that's a good idea.
I think that adding a new method could be disturbing. Instead I plan:
- to deprecate .renameAll
- to deprecate the current usage of .rename
- to integrate your new behaviour on .rename (keeping the current behaviour beside).
Are you working on a PR ?
HI @Gmousse : Yes Im working on it already. Will issue a PR by this weekend.
Hi @Gmousse , i have raised the PR.
About the decprecations, i can volunteer for that.
Hi @anusha5695 , thank you for the PR, I will review it asap. Don't worry about the deprecation, I take it.
Hi @Gmousse : Did you get a chance to look at it?
Hi sorry I was busy @Gmousse (summer doesn't help :D).
I keep 1 hour tommorow to review your PR.