I m playing with pandas and trying to apply string slicing on a Series of strings object. Instead of getting the strings sliced, the series gets sliced:
In [22]: s = p.Series(data=[ abcdef ]*20)
In [23]: s.apply(lambda x:x[:2])
Out[24]:
0 abcdef
1 abcdef
另一方面:
In [25]: s.apply(lambda x:x+ qwerty )
Out[25]:
0 abcdefqwerty
1 abcdefqwerty
2 abcdefqwerty
...
我用地图功能来开展工作,但我认为我不了解它如何工作。
Would very much appreciate a clarification.