How can I rename several columns in dataprep?

636 Views Asked by At

I have more than 100 columns in dataprep whose names are like:

my column name 1

my column name 2

I would like to rename the name of the columns to be:

my_column_name_1

my_column_name_2

I have tried to do a rename, changing " " by "_". However, dataprep only changes the first whitespace! Is there any way to change all the whitespaces?

Another question, when I do a function like rename, it is done just for a column. I can add more columns writing the name of de column. Is there any way to select all columns without writing all the names?

thank you so much!

2

There are 2 best solutions below

2
On BEST ANSWER

You can shift-select multiple columns to Transform when the data is in column view mode.

Column Browser

Select the columns to apply to and then choose the transformation.

3
On

JSDBroughton answer did the trick for me although it's not so clear how to do it. Change your view to Columns (second icon from the left on the toolbar). Select the first column, then hold Shift and select the last column. You should now have all columns selected. Then right clock and select Rename. A new Recipe step will be added with all your columns already added. Then set the Option to "Find and replace".

In terms removing all the spaces I couldn't find any Cloud Dataprep pattern or Regular Expression which let me replace all my spaces in my columns. Having said that my columns had a maximum of 4 spaces so I simply added the same step multiple times. I used the Regular Expression \s to match spaces and I replaced them underscores.

enter image description here