[Python] Pandas / IPython Notebook: Include and display an Image in a dataframe

Discussão em 'Python' iniciado por Stack, Abril 21, 2025.

  1. Stack

    Stack Membro Participativo

    I have a pandas Dataframe which also has a column with a filename of an image. How can I display the image inside of the DataFrame?

    I tried the following:

    import pandas as pd
    from IPython.display import Image

    df = pd.DataFrame(['./image01.png', './image02.png'], columns = ['Image'])

    df['Image'] = Image(df['Image'])


    But when I show the frame, each column only shows the to_string representation of the Image Object.

    Image
    0 IPython.core.display.Image object
    1 IPython.core.display.Image object


    Is there any solution for this?

    Thanks for your help.

    Continue reading...

Compartilhe esta Página