I'm trying to sort a dataframe using the sort_values method. I have a dataframe (df) with just two columns ('TS','VALUES') and I always getting a error as the follwoing:
df.columns
Out[88]: Index(['TS', 'VALUES'], dtype='object')
df.sort_values(by='TS',axis=1,ascending=True,inplace=True,kind='quicksort',na_position='last')
Traceback (most recent call last):
File "<ipython-input-89-53f79846b56c>", line 1, in <module>
df.sort_values(by='TS',axis=1,ascending=True,inplace=True,kind='quicksort',na_position='last')
File "C:\Users\gianm\Anaconda3\lib\site-packages\pandas\core\frame.py", line 4421, in sort_values
stacklevel=stacklevel)
File "C:\Users\gianm\Anaconda3\lib\site-packages\pandas\core\generic.py", line 1382, in _get_label_or_level_values
raise KeyError(key)
KeyError: 'TS'
It seems python does not recognize the name of the columns. Where I'am wrong ? Thanks