Pandas astype() returns a new Series instead of converting in place

Pandas astype() returns a new Series instead of converting in place

Python Pandas astype() returns a NEW series — it doesn’t modify in place:

s = s.astype('int8')
s = s.astype('float64')
s = s.astype(str)

Watch out: You’ll get a TypeError if any value can’t be converted