Remove columns by pattern

Solved!
nshapir2
Level 1
Remove columns by pattern

Lets say I want to remove all the columns that contain the word "Spot" in them. How would I do that. I cannot figure out the syntax for Remove columns matching. 

0 Kudos
1 Solution
AlexT
Dataiker

Hi,

You could do this using a Visual Prepare recipe and adding a step with the processor library "Delete/Keep Columns by name". 

https://doc.dataiku.com/dss/latest/preparation/processors/columns-select.html#delete-keep-columns-by...

Within that you can use regex to match on the pattern you are looking for example: .*Spot.*

 

View solution in original post

0 Kudos
6 Replies
AlexT
Dataiker

Hi,

You could do this using a Visual Prepare recipe and adding a step with the processor library "Delete/Keep Columns by name". 

https://doc.dataiku.com/dss/latest/preparation/processors/columns-select.html#delete-keep-columns-by...

Within that you can use regex to match on the pattern you are looking for example: .*Spot.*

 

0 Kudos
nshapir2
Level 1
Author

Thank you for your help!

0 Kudos
IsaNob
Level 1

Hi @AlexT ,

I tried to use your solution for remove columns using pattern to remove all which start with a common text phrase but the formula did not work.

The text phrase is FR_AMER_ so I used the regex .*FR_AMER_.* but all the columns are still in the table preview.

0 Kudos
AlexT
Dataiker

If you want to remove columns that start with a string you can use slightly different regex :

^FR_AMERT_.*
0 Kudos
kkrdataiku
Level 1

Doesn't work for me. I have attached a screenshot can you please help me with that? TIA

0 Kudos
Jurre
Level 5

For building and testing regex https://regex101.com/  is a nice resource.