Skip to content

Commit 65996e6

Browse files
committed
REF: reduce for combining mask pair-wise
1 parent c80b2d3 commit 65996e6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/io/pytables.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from contextlib import suppress
66
import copy
77
from datetime import date, tzinfo
8+
from functools import reduce
89
import itertools
910
import os
1011
import re
@@ -4297,9 +4298,8 @@ def write_data(self, chunksize: Optional[int], dropna: bool = False):
42974298

42984299
# consolidate masks
42994300
if len(masks):
4300-
mask = masks[0]
4301-
for m in masks[1:]:
4302-
mask = mask & m
4301+
combine_masks = lambda first, second: first & second
4302+
mask = reduce(combine_masks, masks)
43034303
mask = mask.ravel()
43044304
else:
43054305
mask = None

0 commit comments

Comments
 (0)