@@ -1524,7 +1524,7 @@ def iterrows(self) -> Iterable[tuple[Hashable, Series]]:
1524
1524
"""
1525
1525
columns = self .columns
1526
1526
klass = self ._constructor_sliced
1527
- for k , v in zip (self .index , self .values ):
1527
+ for k , v in zip (self .index , self .values , strict = True ):
1528
1528
s = klass (v , index = columns , name = k ).__finalize__ (self )
1529
1529
if self ._mgr .is_single_block :
1530
1530
s ._mgr .add_references (self ._mgr )
@@ -1607,10 +1607,10 @@ def itertuples(
1607
1607
itertuple = collections .namedtuple ( # type: ignore[misc]
1608
1608
name , fields , rename = True
1609
1609
)
1610
- return map (itertuple ._make , zip (* arrays ))
1610
+ return map (itertuple ._make , zip (* arrays , strict = True ))
1611
1611
1612
1612
# fallback to regular tuples
1613
- return zip (* arrays )
1613
+ return zip (* arrays , strict = True )
1614
1614
1615
1615
def __len__ (self ) -> int :
1616
1616
"""
@@ -4359,7 +4359,7 @@ def _setitem_array(self, key, value) -> None:
4359
4359
4360
4360
if isinstance (value , DataFrame ):
4361
4361
check_key_length (self .columns , key , value )
4362
- for k1 , k2 in zip (key , value .columns ):
4362
+ for k1 , k2 in zip (key , value .columns , strict = False ):
4363
4363
self [k1 ] = value [k2 ]
4364
4364
4365
4365
elif not is_list_like (value ):
@@ -4465,7 +4465,7 @@ def _set_item_frame_value(self, key, value: DataFrame) -> None:
4465
4465
if len (cols_droplevel ) and not cols_droplevel .equals (value .columns ):
4466
4466
value = value .reindex (cols_droplevel , axis = 1 )
4467
4467
4468
- for col , col_droplevel in zip (cols , cols_droplevel ):
4468
+ for col , col_droplevel in zip (cols , cols_droplevel , strict = True ):
4469
4469
self [col ] = value [col_droplevel ]
4470
4470
return
4471
4471
@@ -6567,7 +6567,11 @@ class max type
6567
6567
names = self .index ._get_default_index_names (names , default )
6568
6568
6569
6569
if isinstance (self .index , MultiIndex ):
6570
- to_insert = zip (reversed (self .index .levels ), reversed (self .index .codes ))
6570
+ to_insert = zip (
6571
+ reversed (self .index .levels ),
6572
+ reversed (self .index .codes ),
6573
+ strict = True ,
6574
+ )
6571
6575
else :
6572
6576
to_insert = ((self .index , None ),)
6573
6577
@@ -7093,7 +7097,7 @@ def f(vals) -> tuple[np.ndarray, int]:
7093
7097
result .name = None
7094
7098
else :
7095
7099
vals = (col .values for name , col in self .items () if name in subset )
7096
- labels , shape = map (list , zip (* map (f , vals )))
7100
+ labels , shape = map (list , zip (* map (f , vals ), strict = True ))
7097
7101
7098
7102
ids = get_group_index (labels , tuple (shape ), sort = False , xnull = False )
7099
7103
result = self ._constructor_sliced (duplicated (ids , keep ), index = self .index )
@@ -7346,7 +7350,9 @@ def sort_values(
7346
7350
7347
7351
# need to rewrap columns in Series to apply key function
7348
7352
if key is not None :
7349
- keys_data = [Series (k , name = name ) for (k , name ) in zip (keys , by )]
7353
+ keys_data = [
7354
+ Series (k , name = name ) for (k , name ) in zip (keys , by , strict = True )
7355
+ ]
7350
7356
else :
7351
7357
# error: Argument 1 to "list" has incompatible type
7352
7358
# "Generator[ExtensionArray | ndarray[Any, Any], None, None]";
@@ -8208,7 +8214,7 @@ def _dispatch_frame_op(
8208
8214
8209
8215
arrays = [
8210
8216
array_op (_left , _right )
8211
- for _left , _right in zip (self ._iter_column_arrays (), right )
8217
+ for _left , _right in zip (self ._iter_column_arrays (), right , strict = True )
8212
8218
]
8213
8219
8214
8220
elif isinstance (right , Series ):
@@ -11745,7 +11751,7 @@ def c(x):
11745
11751
return nanops .nancorr (x [0 ], x [1 ], method = method )
11746
11752
11747
11753
correl = self ._constructor_sliced (
11748
- map (c , zip (left .values .T , right .values .T )),
11754
+ map (c , zip (left .values .T , right .values .T , strict = True )),
11749
11755
index = left .columns ,
11750
11756
copy = False ,
11751
11757
)
0 commit comments