1
$\begingroup$

I use python 3.7.3 and I run this code on Jupyter Notebook .

I have a column named 'image' in my Dataframe named df that contains Url of images I wanna visualize inside the df.

I saw some answers and I tried to use this code:


from IPython.display import Image, HTML

def path_to_image_html(path):

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

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

However, I get this result instead:

enter image description here

Can anyone tell me how I get the images using this code or any other code.

$\endgroup$
  • $\begingroup$ Possible duplicate of Display Images (url) Inside Pandas Dataframe $\endgroup$ – TwinPenguins Sep 7 '19 at 6:36
  • $\begingroup$ @TwinPenguins as you see I used the same code but it didn't work for me, I still don't know why $\endgroup$ – AyoubAjarra Sep 7 '19 at 9:57
  • $\begingroup$ You are right. It is not reproducible. I just reopened it again. I will have a look too. I think some sort of HTML settings need to be changed. $\endgroup$ – TwinPenguins Sep 7 '19 at 17:48
  • $\begingroup$ I would move this question in stackoverflow. Here it is more about Data Science. $\endgroup$ – TwinPenguins Sep 8 '19 at 7:10
  • $\begingroup$ I will do that, thanks ! $\endgroup$ – AyoubAjarra Sep 9 '19 at 7:07