samedi 7 juin 2014

pandas vectorized string replace by index


Vote count:

0




Trying to change the first two characters in a pandas column string.



def shift(x):
x=list(x)
x[0] = '1'
x[1] = '9'
print x
str(x)

mc_data['timeshift'] = mc_data['realtime'].map(lambda x: shift(x) )


output is NoneType


I also tried, str.slice_replace.map(lambda x: '19').


How do I do this?



asked 14 mins ago






Aucun commentaire:

Enregistrer un commentaire