I have a data frame which has a column containing the image URL links in the following format. I want to perform the following tasks: 1) display these images in another column
2) exception check for no image or corrupt image

The df looks like-
id     imageUrl
1      img-0000356-wa7854.jpg
2      img_6785730_567389.jpg

I tried implementing the following-

def path_to_image_html(path):
    return '<img src="'+ path + '" style=max-height:124px;"/>'

HTML(df.to_html(escape=False ,formatters=dict(imageUrl=path_to_image_html)))

Can anyone help me in knowing how to deal with image URL data and implement the above-mentioned tasks?

0 Answers