Skip to content

Commit 26cb4ca

Browse files
committed
BUG: Simplified the mask generation method in make_spase
1 parent 7727c5a commit 26cb4ca

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/core/sparse/array.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -794,9 +794,9 @@ def make_sparse(arr, kind='block', fill_value=None):
794794
mask = np.ones(len(arr), dtype=np.bool)
795795
fv_type = type(fill_value)
796796

797-
itr = (type(x) is fv_type for x in arr)
798-
cond = np.fromiter(itr, dtype=np.bool)
799-
mask[cond] = arr[cond] != fill_value
797+
for i, x in enumerate(arr):
798+
if type(x) is fv_type:
799+
mask[i] = arr[i] != fill_value
800800
else:
801801
mask = arr != fill_value
802802

0 commit comments

Comments
 (0)