I've seen this question asked a few times, but the suggested answers don't seem to be working for me. I've brought in a csv with read_csv and am trying to clean up the names, which are initially:
In [89]: data.columns
Out[89]:
Index(['Node Number', 'X [ m ]', 'Y [ m ]', 'Z [ m ]',
'Turbulence Kinetic Energy [ m^2 s^-2 ]', 'turbulenceIntensity',
'Velocity u [ m s^-1 ]', 'Velocity v [ m s^-1 ]',
'Velocity w [ m s^-1 ]', 'windspeedratio'],
dtype='object')
The simplest suggestion I've found should be:
data.rename(columns=lambda x: x.strip(), inplace=True)
But if I try that, absolutely nothing changes. Same with
data.columns = data.columns.str.strip()
Any idea why?