I have a pandas dataframe named Value.
Value:
Tenor CurrPrice
0 on 0.123
1 1b 0.234
2 tn 0.456
3 1w 0.678
Now, when I do set_index function call in pandas version 3.4 I get:
Value.set_index('Tenor',inplace=True)
Value
CurrPrice
Tenor
on 0.123
1b 0.234
tn 0.456
1w 0.678
But when I do set_index function call in pandas version 3.6 I get:
Value.set_index('Tenor',inplace=True)
Value
CurrPrice
Tenor
(on,) 0.123
(1b,) 0.234
(tn,) 0.456
(1w,) 0.678
So Basically the Python 3.6 version set_index call when setting the index adding the small brackets and comma to the value, which is causing issues for my process. Two questions:
- Why it is like this ?
- How can I fix the Python 3.6 version output so that it becomes like python 3.4 to fix the process.
Having 'small brackets and a comma to the value' means, that the values are of type tuple, and not string, as in your first example.
This should result from the data of the DataFrame, and not the
pd.set_indexmethod.Check the types of the values of the column, this should provide some clarify.