So I have this Series data that can look like this
1 532
2 554
3 NaN
... ...
Name: score, Length: 941940, dtype: str
and I split it into 3 columns on each character using apply(lambda x: pd.Series(list(x)
, but it throws an error for the index 3 because it's NaN
. How do I use apply
so that it supports NaN and splits the value like below?
score_0 score_1 score_2
1 5 3 2
2 5 5 4
3 NaN NaN NaN
... ... ... ...
[941940 rows x 3 columns]