0
试图更改熊猫列字符串中的前两个字符。熊猫矢量化字符串替换索引
def shift(x):
x=list(x)
x[0] = '1'
x[1] = '9'
print x #this prints the correct result as list
##str(x)
return ''.join(x) ## this works
mc_data['timeshift'] = mc_data['realtime'].map(lambda x: shift(x))
输出NoneType
我也试过,str.slice_replace.map(lambda x: '19')
。
我该怎么做?