Skip to content

Commit c155059

Browse files
committed
PERF: increase performance of string split when expand=True
1 parent 9b04bd0 commit c155059

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pandas/core/strings.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,11 @@ def _wrap_result_expand(self, result, expand=False):
10901090
else:
10911091
index = self.series.index
10921092
if expand:
1093-
cons_row = self.series._constructor
1093+
def cons_row(x):
1094+
if x is np.nan:
1095+
return [ x ]
1096+
else:
1097+
return x
10941098
cons = self.series._constructor_expanddim
10951099
data = [cons_row(x) for x in result]
10961100
return cons(data, index=index)

0 commit comments

Comments
 (0)