Display multiple output tables in IPython notebook using Pandas

落爺英雄遲暮 提交于 2020-01-11 05:11:05

问题


I now know that I can output multiple charts from IPython pandas by embedding them in one plot space which will appear in a single output cell in the notebook.

Can I do something similar with Pandas HTML Tables?

I am getting data from multiple tabs (about 15-20) on a spreadsheet and running them though a set of regressions and I'd like to display the results together, perhaps 2 up.. But since the function to display the table only displays one, the last one, not sure how to approach. Ideas?

I'd even be happy to display in successive output cells.. not real sure how to do that either But I guess I could do something really dirty calling each (spreadsheet) tab in a separate cell.. Ughh... FWIW I'm on IPython 2.0 dev and Pandas 13


回答1:


This does it:

area-tabs=list(map(str, range(1, 28))) # for all 27 tabs
#area_tabs=['1','2'] # for specific tabs
for area_tabs in area_tabs:
    actdf,aname = get_data(area_tabs) #get_data gets the data and does a bunch or regression and table building
    aname,actdf,merged2,mergederrs,montdist,ols_test,mergedfcst=projections(actdf)
    IPython.display.display('Area: %s' % aname, mergederrs.tail(12))
    IPython.display.display('Area: %s' % aname, ols_test)
    IPython.display.display('Area: %s' % aname, merged2)

SO I can print all the results for each tab on the spreadsheet



来源:https://stackoverflow.com/questions/21207990/display-multiple-output-tables-in-ipython-notebook-using-pandas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!