#!/usr/bin/env python # coding: utf-8 # In[1]: import sys sys.version_info # In[2]: import petl as etl etl.__version__ # In[3]: tbl = etl.dummytable(10, seed=42) tbl # In[4]: tbl.display(2) # In[5]: tbl.displayall() # In[6]: tbl.display() tbl.display(index_header=True) # In[7]: tbl.display(caption='example data') # In[9]: tbl.display(epilogue='example data') # In[10]: tbl.display(truncate=4) # In[11]: tbl.display(tr_style=lambda row: 'background-color: %s' % ('#faa' if row.foo > 50 else 'white')) # In[12]: tbl.display(tr_style='font-size: .8em', td_styles={'bar': 'background-color: yellow', 'baz': lambda v: 'background-color: %s' % ('#faa' if v > .5 else '#aaf')}) # In[13]: t = ((u'name', u'id'), (u'Արամ Խաչատրյան', 1), (u'Johann Strauß', 2), (u'Вагиф Сәмәдоғлу', 3), (u'章子怡', 4), (u'Արամ Խաչատրյան', 1), (u'Johann Strauß', 2), (u'Вагиф Сәмәдоғлу', 3), (u'章子怡', 4)) t # In[14]: tbl2 = etl.wrap(t) tbl2 # In[15]: tbl2.display(caption='unicode example') # In[13]: