Skip to content

Commit 70e077a

Browse files
committed
Deal with empty input data
1 parent 11e168f commit 70e077a

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
@@ -1002,7 +1002,11 @@ def str_get_dummies(arr, sep='|'):
10021002
from pandas.core.reshape.reshape import get_dummies
10031003
from pandas import Series
10041004

1005-
arr = arr.fillna('')
1005+
if len(arr) == 0:
1006+
empty = np.empty(0, dtype='object')
1007+
return empty, empty
1008+
1009+
arr = arr.fillna('').astype('str')
10061010

10071011
arr_split = arr.str.split(sep)
10081012

0 commit comments

Comments
 (0)