I have a string series containing multiples words. I want to extract the first character of each word per row in a vectorized fashion.
So far, I have been able to split the words into a list, but haven't found a vectorized way of getting the first characters.
s = pd.Series(['aa bb cc', 'cc dd ee', 'ff ga', '0w'])
>>> s. str.split()
0 [aa, bb, cc]
1 [cc, dd, ee]
2 [ff, ga]
0 [a, b, c]
1 [c, d, e]
2 [f, g]
A straightforward way would be to use the
In : s.str.split().map(lambda lst : [string for string in lst]) Out: 0 [a, b, c] 1 [c, d, e] 2 [f, g] 3  dtype: object