-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
BUG: to_html misses truncation indicators (...) when index=False #22786
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
Changes from 1 commit
72b8011
a7b2424
8a82df5
f028b7d
4c1bca8
2cd532e
d8fe9b5
ecad6c8
46d171f
c6cb507
de99a65
15bd352
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,6 +306,8 @@ def _column_header(): | |
align = self.fmt.justify | ||
|
||
if truncate_h: | ||
if self.fmt.index is False: | ||
row_levels = 0 | ||
ins_col = row_levels + self.fmt.tr_col_num | ||
col_row.insert(ins_col, '...') | ||
|
||
|
@@ -342,10 +344,22 @@ def _write_body(self, indent): | |
self._write_hierarchical_rows(fmt_values, indent) | ||
else: | ||
self._write_regular_rows(fmt_values, indent) | ||
# GH 15019, GH 22783 add truncation logic below | ||
else: | ||
for i in range(min(len(self.frame), self.max_rows)): | ||
row = [fmt_values[j][i] for j in range(len(self.columns))] | ||
truncate_h = self.fmt.truncate_h | ||
truncate_v = self.fmt.truncate_v | ||
ncols = len(self.fmt.tr_frame.columns) | ||
nrows = len(self.fmt.tr_frame) | ||
|
||
row = [] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you give some comments on what is happening here, would not object to a self.write_row? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jreback But for the Currently the truncation tests in To avoid potential regression on the notebook display codepath ( Tests could be added but I wanted to avoid going out of scope on this PR. The existing code for the So I would agree that a How should I proceed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
can you do a pre-cursor PR which locks down the tests first? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @simonjayhawkins i mean comments in the code |
||
for i in range(nrows): | ||
if truncate_v and i == (self.fmt.tr_row_num): | ||
str_sep_row = ['...'] * len(row) | ||
self.write_tr(str_sep_row, indent, | ||
self.indent_delta, tags=None) | ||
row = [fmt_values[j][i] for j in range(ncols)] | ||
if truncate_h: | ||
dot_col_ix = self.fmt.tr_col_num | ||
row.insert(dot_col_ix, '...') | ||
self.write_tr(row, indent, self.indent_delta, tags=None) | ||
|
||
indent -= self.indent_delta | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,3 @@ | |
</tr> | ||
</tbody> | ||
</table> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing
is False
can you leverage the implicit truthiness here and doif not self.fmt.index
? While not documented I believeindex=0
andindex=None
are acceptable in this and other parsers, so would be ideal to handle those consistently with FalseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you update this