disply_multiple_dataframe¶
In [1]:
import pandas as pd
import IPython.core.display as display
import IPython.display
"""
↑
from IPython.core.display import *
from IPython.lib.display import *
lib.display includes
__all__ = ['Audio', 'IFrame', 'YouTubeVideo', 'VimeoVideo', 'ScribdDocument',
'FileLink', 'FileLinks']
"""
df = pd.DataFrame(dict(a=range(4)))
print("index: 0 (print)")
IPython.display.display(df[0:1])
print("index: 1 (print)")
display.display(df[1:2])
print("index: 2 (print)")
display.display_html(df[2:3])
print("index: 3 (Out to Cell)")
df[3:]
index: 0 (print)
a | |
---|---|
0 | 0 |
index: 1 (print)
a | |
---|---|
1 | 1 |
index: 2 (print)
a | |
---|---|
2 | 2 |
index: 3 (Out to Cell)
Out[1]:
a | |
---|---|
3 | 3 |
In [1]:
import pandas as pd
from IPython.display import display
df = pd.DataFrame(dict(a=range(4)))
class HorizontalDisplay:
def __init__(self, *args):
self.args = args
def _repr_html_(self):
template = '<div style="float: left; padding: 10px;">{0}</div>'
return "\n".join(template.format(arg._repr_html_())
for arg in self.args)
display(HorizontalDisplay(df, df))
HorizontalDisplay(df, df)
a | |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
a | |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
Out[1]:
a | |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |
a | |
---|---|
0 | 0 |
1 | 1 |
2 | 2 |
3 | 3 |