Forum Discussion

vsunilbabu's avatar
vsunilbabu
New Contributor II
6 years ago

Separate words in column name

Hello,

Can you please help separating my column names using ‘_’ whenever there are capital letters in the column name.

For example:
Input

Output

In my research, I understood that findall() function can help iterating through all column names, using the logic: output.append(“_”.join(re.findall(‘[A-Z][^A-Z]*’, i)))

Can someone help me with a script for this? Or if there is any other better way.

Thanks,
Sunil