Python Reindex Producing Nan

The docs are clear on this behaviour :

Conform Series to new index with optional filling logic, placing
NA/NaN in locations having no value in the previous index

if you just want to overwrite the index values then do:

In [32]:
test3.index  = ['f','g','z']

test3
Out[32]:
f    1
g    2
z    3
dtype: int64

Leave a Comment