If I just construct a pandas DataFrame in a Jupyter notebook, then the output looks nice:
frame = pd.DataFrame({'a': [1,2,3]})
frame
However, if I make my own class whose repr is a pandas.DataFrame, then that formatting is lost:
class Foo:
    def __init__(self, frame, bar):
        self.frame = frame
        self.bar = bar
    
    def __repr__(self):
        return repr(self.frame)
How can I define the repr of my class Foo, such that when I display it in a Jupyter Notebook, it'll look just like it would if it was a pandas.DataFrame?


 
    