@@ -579,7 +579,7 @@ def _initialize_colspace(self, col_space: ColspaceArgType | None) -> ColspaceTyp
579
579
f"Col_space length({ len (col_space )} ) should match "
580
580
f"DataFrame number of columns({ len (self .frame .columns )} )"
581
581
)
582
- result = dict (zip (self .frame .columns , col_space ))
582
+ result = dict (zip (self .frame .columns , col_space , strict = True ))
583
583
return result
584
584
585
585
def _calc_max_cols_fitted (self ) -> int | None :
@@ -786,7 +786,7 @@ def _get_formatted_column_labels(self, frame: DataFrame) -> list[list[str]]:
786
786
if self .sparsify and len (fmt_columns ):
787
787
fmt_columns = sparsify_labels (fmt_columns )
788
788
789
- str_columns = [list (x ) for x in zip (* fmt_columns )]
789
+ str_columns = [list (x ) for x in zip (* fmt_columns , strict = True )]
790
790
else :
791
791
fmt_columns = columns ._format_flat (include_name = False )
792
792
str_columns = [
@@ -795,7 +795,9 @@ def _get_formatted_column_labels(self, frame: DataFrame) -> list[list[str]]:
795
795
if not self ._get_formatter (i ) and is_numeric_dtype (dtype )
796
796
else x
797
797
]
798
- for i , (x , dtype ) in enumerate (zip (fmt_columns , self .frame .dtypes ))
798
+ for i , (x , dtype ) in enumerate (
799
+ zip (fmt_columns , self .frame .dtypes , strict = True )
800
+ )
799
801
]
800
802
return str_columns
801
803
@@ -1359,7 +1361,7 @@ def format_with_na_rep(
1359
1361
formatted = np .array (
1360
1362
[
1361
1363
formatter (val ) if not m else na_rep
1362
- for val , m in zip (values .ravel (), mask .ravel ())
1364
+ for val , m in zip (values .ravel (), mask .ravel (), strict = True )
1363
1365
]
1364
1366
).reshape (values .shape )
1365
1367
return formatted
@@ -1377,6 +1379,7 @@ def format_complex_with_na_rep(
1377
1379
imag_values ,
1378
1380
real_mask ,
1379
1381
imag_mask ,
1382
+ strict = True ,
1380
1383
):
1381
1384
if not re_isna and not im_isna :
1382
1385
formatted_lst .append (formatter (val ))
@@ -1796,7 +1799,7 @@ def _trim_zeros_complex(str_complexes: ArrayLike, decimal: str = ".") -> list[st
1796
1799
+ imag_pt [0 ] # +/-
1797
1800
+ f"{ imag_pt [1 :]:>{padded_length }} " # complex part (no sign), possibly nan
1798
1801
+ "j"
1799
- for real_pt , imag_pt in zip (padded_parts [:n ], padded_parts [n :])
1802
+ for real_pt , imag_pt in zip (padded_parts [:n ], padded_parts [n :], strict = True )
1800
1803
]
1801
1804
return padded
1802
1805
0 commit comments