-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[RDF] add HTML display #17106
[RDF] add HTML display #17106
Conversation
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.
Thank you, this is great! I have a couple of minor comments to improve the already very nice changes. As a side thought, these changes also change the behaviour of df.Display
in the case of interactive use, from lazy to instant, i.e. now the RDataFrame will run the Display action immediately to print the output table to screen. I believe that's more than valid for interactive use, but we should probably document this. Can you add a line to the release notes (for 6.36 at this point)? Then we should also add some doc about this in the docstrings that can be found in _rdataframe.py
def repr(klass): | ||
import ROOT | ||
opts = ROOT.RDF.RDisplay.RPrintOptions() | ||
opts.fFormat = ROOT.RDF.RDisplay.EPrintFormat.kHtml | ||
return klass.AsString(opts) | ||
klass._repr_html_ = repr |
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.
Maybe we can add for the non-IPython interactive use case
klass.__repr__ = lambda self: self.AsString()
which will show the markdown table which is friendlier for terminal-based interaction
return {}; | ||
} | ||
|
||
std::string RDisplay::AsStringHtml() const |
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.
Can you also add vertical separators between different columns of the table?
Test Results 18 files 18 suites 4d 7h 22m 57s ⏱️ For more details on these failures, see this check. Results for commit 5605fae. ♻️ This comment has been updated with latest results. |
d404135
to
374cc85
Compare
bbe0e2e
to
d6af15a
Compare
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.
Fantastic!!!
I suggest squashing the commits and applying clang-format suggestions if it makes sense before merging |
[RDF] fix test expectation for display
d6af15a
to
5605fae
Compare
This Pull request:
builds on #17081 and adds the option to print a RDisplay as a HTML table.
Additionally, it uses the HTML display by default as a repr for notebooks.
This is a sample output:

Checklist: