示例#1
0
def display(tbl, limit=None, **kwargs):
    """
    Display a table inline within an iPython notebook. E.g.::
    
        In [0]: from petlx.ipython import display
                tbl = [['foo', 'bar'], ['a', 1], ['b', 2]]
                display(tbl)
                
    Alternatively, using the fluent style::
    
        In [0]: import petl.interactive as etl
                import petlx.ipython
                tbl = etl.wrap([['foo', 'bar'], ['a', 1], ['b', 2]])
                tbl.display()
                
    .. versionadded:: 0.5  
    
    """

    try:
        from IPython.core.display import display_html
    except ImportError as e:
        raise UnsatisfiedDependency(e, dep_message)
    else:
        html = repr_html(tbl, limit=limit, **kwargs)
        display_html(html, raw=True)
示例#2
0
文件: ipython.py 项目: ianfiske/petlx
def display(tbl, limit=None, **kwargs):
    """
    Display a table inline within an iPython notebook. E.g.::
    
        In [0]: from petlx.ipython import display
                tbl = [['foo', 'bar'], ['a', 1], ['b', 2]]
                display(tbl)
                
    Alternatively, using the fluent style::
    
        In [0]: import petl.interactive as etl
                import petlx.ipython
                tbl = etl.wrap([['foo', 'bar'], ['a', 1], ['b', 2]])
                tbl.display()
                
    .. versionadded:: 0.5  
    
    """

    try:
        from IPython.core.display import display_html
    except ImportError as e:
        raise UnsatisfiedDependency(e, dep_message)
    else:
        html = repr_html(tbl, limit=limit, **kwargs)
        display_html(html, raw=True)
示例#3
0
def _display(tbl, sliceargs, **kwargs):
    try:
        from IPython.core.display import display_html
    except ImportError as e:
        raise UnsatisfiedDependency(e, dep_message)
    if sliceargs is not None:
        tbl = rowslice(tbl, *sliceargs)
    html = repr_html(tbl, **kwargs)
    display_html(html, raw=True)