Getting rid of specific white spaces at the beginning and end of string
So I have actually found the answer, but thanks for the help!
data_frame_trimmed = dataset.apply(lambda x: x.str.strip() if x.dtype == "object" else x)
I created a column out of the values of other two columns. However, the problems is that there are undesired white spaces at the end and beginning of many values of the column for example:
"  Hernandez"
"Martinez  "
"Gutierrez Romero" (This one is actually a desired white-space case)
I can not simply get rid of all the white spaces because there are some white spaces that need to be there like in the case of "Gutierrez Romero" I was wondering if anybody can help me to fix this problems thanks