2017-11-30 2 views
0

Ich verwende ipywidgets, um ein Karussell von Bildern in Jupyter Notizbuch anzuzeigen. Ich möchte eine Tabelle, die jedem Bild unter dem Bild entspricht. Ich kämpfe darum, und jeder Rat würde geschätzt werden.Tabellen unter Bildern in Jupyter Notebook anzeigen

Unten ist ein Beispielcode von dem, was ich bisher getan habe. Ich brauche Hilfe der tmp Datenrahmen unter jedem Bild angezeigt wird:

from ipywidgets import * 
import pandas as pd 
import requests 
from ipywidgets import * 
from IPython.display import display, HTML 

tmp = pd.DataFrame({'metric': ['A', 'B', 'C'], 
        'value': range(3)}) 

box_layout = Layout(overflow_x='scroll', 
        width='1000px', 
        flex_direction='row', 
        display='flex') 

item = Image(value=requests.get(
    'http://www.godalmingmuseum.org.uk/uploads/images/People/Jekyll/Jekyll,_Gertrude,_middle_aged_Y.JPG' 
).content) 
item 
items = [item, item, item,item, item, item] 

carousel = Box(children=items, layout=box_layout) 
VBox([Label('Images:'), carousel]) 

Antwort

0

Sie können jedes Bild/Tabellen-Paar in einem VBox hinzufügen, dass wird dann zu dem HBox Karussell. Das heißt:

items = [VBox(children=[item, table]), 
     VBox(children=[item, table]), 
     VBox(children=[item, table]), 
     VBox(children=[item, table]), 
     VBox(children=[item, table]), 
     ] 


carousel = Box(children=items, layout=box_layout) 

Ich bin nicht vertraut genug mit Pandas sagen, wie die einführbare table Eintrag zu erhalten.