Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed bug where pd.NA was being cast to NaN during formatting #55754

Merged
merged 13 commits into from
Nov 7, 2023
6 changes: 3 additions & 3 deletions pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,9 @@ def _truncate_vertically(self) -> None:
assert self.max_rows_fitted is not None
row_num = self.max_rows_fitted // 2
if row_num >= 1:
head = self.tr_frame.iloc[:row_num, :]
tail = self.tr_frame.iloc[-row_num:, :]
self.tr_frame = concat((head, tail))
_len = len(self.tr_frame)
rows = np.arange(_len)
self.tr_frame = self.tr_frame.iloc[(rows < row_num) | (rows >= _len - row_num)]
else:
row_num = cast(int, self.max_rows)
self.tr_frame = self.tr_frame.iloc[:row_num, :]
Expand Down
Loading