Gmousse / dataframe-js

No Maintenance Intended
https://gmousse.gitbooks.io/dataframe-js/
MIT License
460 stars 38 forks source link

[FEATURE] Allow 1 or many (not necessarily all) columns to be renamed at once. #90

Open anusha5695 opened 5 years ago

anusha5695 commented 5 years ago

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:

  1. we'll have to call df.rename 30 times, one for each column
  2. 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

anusha5695 commented 5 years ago

Im willing to raise a PR for this

Gmousse commented 5 years ago

Hi @anusha5695, that's a good idea.

I think that adding a new method could be disturbing. Instead I plan:

Are you working on a PR ?

anusha5695 commented 5 years ago

HI @Gmousse : Yes Im working on it already. Will issue a PR by this weekend.

anusha5695 commented 5 years ago

Hi @Gmousse , i have raised the PR.

About the decprecations, i can volunteer for that.

Gmousse commented 5 years ago

Hi @anusha5695 , thank you for the PR, I will review it asap. Don't worry about the deprecation, I take it.

anusha5695 commented 5 years ago

Hi @Gmousse : Did you get a chance to look at it?

Gmousse commented 5 years ago

Hi sorry I was busy @Gmousse (summer doesn't help :D).

I keep 1 hour tommorow to review your PR.