@@ -868,12 +868,14 @@ def _get_gross_column_widths(self) -> Sequence[int]:
868
868
body_column_widths = self ._get_body_column_widths ()
869
869
return [
870
870
max (* widths )
871
- for widths in zip (self .header_column_widths , body_column_widths )
871
+ for widths in zip (
872
+ self .header_column_widths , body_column_widths , strict = False
873
+ )
872
874
]
873
875
874
876
def _get_body_column_widths (self ) -> Sequence [int ]:
875
877
"""Get widths of table content columns."""
876
- strcols : Sequence [Sequence [str ]] = list (zip (* self .strrows ))
878
+ strcols : Sequence [Sequence [str ]] = list (zip (* self .strrows , strict = True ))
877
879
return [max (len (x ) for x in col ) for col in strcols ]
878
880
879
881
def _gen_rows (self ) -> Iterator [Sequence [str ]]:
@@ -899,7 +901,9 @@ def add_header_line(self) -> None:
899
901
header_line = self .SPACING .join (
900
902
[
901
903
_put_str (header , col_width )
902
- for header , col_width in zip (self .headers , self .gross_column_widths )
904
+ for header , col_width in zip (
905
+ self .headers , self .gross_column_widths , strict = True
906
+ )
903
907
]
904
908
)
905
909
self ._lines .append (header_line )
@@ -909,7 +913,7 @@ def add_separator_line(self) -> None:
909
913
[
910
914
_put_str ("-" * header_colwidth , gross_colwidth )
911
915
for header_colwidth , gross_colwidth in zip (
912
- self .header_column_widths , self .gross_column_widths
916
+ self .header_column_widths , self .gross_column_widths , strict = True
913
917
)
914
918
]
915
919
)
@@ -920,7 +924,9 @@ def add_body_lines(self) -> None:
920
924
body_line = self .SPACING .join (
921
925
[
922
926
_put_str (col , gross_colwidth )
923
- for col , gross_colwidth in zip (row , self .gross_column_widths )
927
+ for col , gross_colwidth in zip (
928
+ row , self .gross_column_widths , strict = True
929
+ )
924
930
]
925
931
)
926
932
self ._lines .append (body_line )
@@ -980,6 +986,7 @@ def _gen_rows_without_counts(self) -> Iterator[Sequence[str]]:
980
986
self ._gen_line_numbers (),
981
987
self ._gen_columns (),
982
988
self ._gen_dtypes (),
989
+ strict = True ,
983
990
)
984
991
985
992
def _gen_rows_with_counts (self ) -> Iterator [Sequence [str ]]:
@@ -989,6 +996,7 @@ def _gen_rows_with_counts(self) -> Iterator[Sequence[str]]:
989
996
self ._gen_columns (),
990
997
self ._gen_non_null_counts (),
991
998
self ._gen_dtypes (),
999
+ strict = True ,
992
1000
)
993
1001
994
1002
def _gen_line_numbers (self ) -> Iterator [str ]:
@@ -1092,10 +1100,7 @@ def _gen_rows_without_counts(self) -> Iterator[Sequence[str]]:
1092
1100
1093
1101
def _gen_rows_with_counts (self ) -> Iterator [Sequence [str ]]:
1094
1102
"""Iterator with string representation of body data with counts."""
1095
- yield from zip (
1096
- self ._gen_non_null_counts (),
1097
- self ._gen_dtypes (),
1098
- )
1103
+ yield from zip (self ._gen_non_null_counts (), self ._gen_dtypes (), strict = True )
1099
1104
1100
1105
1101
1106
def _get_dataframe_dtype_counts (df : DataFrame ) -> Mapping [str , int ]:
0 commit comments