Skip to content

Commit

Permalink
add better display for empty DF in jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
subbyte committed Jul 29, 2024
1 parent fb73d82 commit 4232cdf
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def to_html_blocks(d: Display) -> Iterable[str]:
if isinstance(d, DataFrame):
d = d.replace("", numpy.nan).dropna(axis="columns", how="all")
escaped_df = d.map(lambda x: x.replace("$", "\\$") if isinstance(x, str) else x)
yield escaped_df.to_html(index=False, na_rep="")
if escaped_df.empty:
yield "<div><i>Nothing Found :-(</i></div>"
else:
yield escaped_df.to_html(index=False, na_rep="")
elif isinstance(d, GraphExplanation):
for graphlet in d.graphlets:
graph = IRGraph(graphlet.graph)
Expand Down

0 comments on commit 4232cdf

Please sign in to comment.