Skip to content

Commit 9a1c452

Browse files
committed
strict to true for info
1 parent 0f4222e commit 9a1c452

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

pandas/io/formats/info.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -868,12 +868,14 @@ def _get_gross_column_widths(self) -> Sequence[int]:
868868
body_column_widths = self._get_body_column_widths()
869869
return [
870870
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=True
873+
)
872874
]
873875

874876
def _get_body_column_widths(self) -> Sequence[int]:
875877
"""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))
877879
return [max(len(x) for x in col) for col in strcols]
878880

879881
def _gen_rows(self) -> Iterator[Sequence[str]]:
@@ -899,7 +901,9 @@ def add_header_line(self) -> None:
899901
header_line = self.SPACING.join(
900902
[
901903
_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+
)
903907
]
904908
)
905909
self._lines.append(header_line)
@@ -920,7 +924,9 @@ def add_body_lines(self) -> None:
920924
body_line = self.SPACING.join(
921925
[
922926
_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+
)
924930
]
925931
)
926932
self._lines.append(body_line)
@@ -980,6 +986,7 @@ def _gen_rows_without_counts(self) -> Iterator[Sequence[str]]:
980986
self._gen_line_numbers(),
981987
self._gen_columns(),
982988
self._gen_dtypes(),
989+
strict=True,
983990
)
984991

985992
def _gen_rows_with_counts(self) -> Iterator[Sequence[str]]:
@@ -989,6 +996,7 @@ def _gen_rows_with_counts(self) -> Iterator[Sequence[str]]:
989996
self._gen_columns(),
990997
self._gen_non_null_counts(),
991998
self._gen_dtypes(),
999+
strict=True,
9921000
)
9931001

9941002
def _gen_line_numbers(self) -> Iterator[str]:
@@ -1092,10 +1100,7 @@ def _gen_rows_without_counts(self) -> Iterator[Sequence[str]]:
10921100

10931101
def _gen_rows_with_counts(self) -> Iterator[Sequence[str]]:
10941102
"""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)
10991104

11001105

11011106
def _get_dataframe_dtype_counts(df: DataFrame) -> Mapping[str, int]:

0 commit comments

Comments
 (0)