We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9c3df8a commit 4a3911aCopy full SHA for 4a3911a
pandas/core/groupby/groupby.py
@@ -544,15 +544,15 @@ def __repr__(self) -> str:
544
return object.__repr__(self)
545
546
def _repr_html_(self) -> str:
547
- html_text = ""
548
- for idx, df_group in self:
549
- if not hasattr(df_group, "to_html"):
550
- df_group = df_group.to_frame()
551
- html_text += f"<H3>Group Key: {idx}<H3/>"
552
- html_text += df_group.to_html(
+ repr_html = ""
+ for group_name, group in self:
+ if not hasattr(group, "to_html"):
+ group = group.to_frame()
+ repr_html += f"<H3>Group Key: {group_name}<H3/>"
+ repr_html += group.to_html(
553
max_rows=get_option("display.max_rows") // self.ngroups
554
)
555
- return html_text
+ return repr_html
556
557
def _assure_grouper(self):
558
"""
0 commit comments