File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ class providing the base-class of operations.
33
33
import numpy as np
34
34
35
35
from pandas ._config .config import option_context
36
+ from pandas ._config import get_option
36
37
37
38
from pandas ._libs import Timestamp
38
39
import pandas ._libs .groupby as libgroupby
@@ -542,6 +543,17 @@ def __repr__(self) -> str:
542
543
# TODO: Better repr for GroupBy object
543
544
return object .__repr__ (self )
544
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 (
553
+ max_rows = get_option ("display.max_rows" ) // self .ngroups
554
+ )
555
+ return html_text
556
+
545
557
def _assure_grouper (self ):
546
558
"""
547
559
We create the grouper on instantiation sub-classes may have a
You can’t perform that action at this time.
0 commit comments