File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -429,12 +429,17 @@ def style_text_size(val, size=12):
429
429
# Filter out some columns for better readability when printing
430
430
filtered_df = combined_df .drop (columns = EXCLUDED_COLUMNS_WHEN_PRINTING )
431
431
try :
432
+ from IPython import get_ipython
432
433
from IPython .display import display
433
434
434
- styled_df = filtered_df .style .applymap (style_text_size )
435
- display (styled_df )
435
+ if get_ipython () is not None :
436
+ styled_df = filtered_df .style .applymap (style_text_size )
437
+ display (styled_df )
438
+ else :
439
+ raise Exception (
440
+ "Environment unable to support IPython. Fall back to print()."
441
+ )
436
442
except :
437
- # TODO: figure out how to trigger this path in python shell
438
443
print (tabulate (filtered_df , headers = "keys" , tablefmt = "fancy_grid" ))
439
444
440
445
# TODO: write unit test
You can’t perform that action at this time.
0 commit comments