Skip to content

Commit b93fc5c

Browse files
committed
PERF: new str.split performance improvement, handles NaN
1 parent 0ff50dc commit b93fc5c

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pandas/core/strings.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,9 @@ def _wrap_result_expand(self, result, expand=False):
10411041
else:
10421042
index = self.series.index
10431043
if expand:
1044-
cons_row = self.series._constructor
10451044
cons = self.series._constructor_expanddim
1046-
data = [cons_row(x) for x in result]
1047-
return cons(data, index=index)
1045+
data = [x if (x is not np.nan) else [None] for x in result]
1046+
return cons(data, index=index).fillna(np.nan)
10481047
else:
10491048
name = getattr(result, 'name', None)
10501049
cons = self.series._constructor

0 commit comments

Comments
 (0)