Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
str.split on np.nan gives np.nan in one column but None in another column #18450
import pandas as pd import numpy as np s = pd.Series(['19HT|C2', np.nan, '20ZT|C1']) print(s)
s_split = s.str.split('|', expand=True) print(s_split)
Just to be clear the issue here is how
The str_split docstring is a little ambiguous because it says it should propagate NaN values, but I think that references the value returned irrespective of the expansion mechanism. Will leave it to others here to comment as to whether or not we think this is a bug with how expansion works, or if the docstring should be modified.