Advertisement
jack06215

[Jupyter] display()

Sep 13th, 2020 (edited)
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. class display(object):
  2.     """Display HTML representation of multiple objects"""
  3.     template = """<div style="float: left; padding: 10px;">
  4.    <b><p style='font-family:"Courier New", Courier, monospace; font-size: 30px;text-align: center;color:red'>{0}</b></p>{1}
  5.    </div>"""
  6.     def __init__(self, *args):
  7.         self.args = args
  8.        
  9.     def _repr_html_(self):
  10.         return '\n'.join(self.template.format(a, eval(a)._repr_html_())
  11.                          for a in self.args)
  12.    
  13.     def __repr__(self):
  14.         return '\n\n'.join(a + '\n' + repr(eval(a))
  15.                            for a in self.args)
  16.  
  17.  
  18. # display('df[df.isnull().any(axis=1)]', 'df_missing')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement