Reputation: 55
I have a data frame which has Book title and Image URL. The total size of the data frame is 10.
Please see the below dataframe. My dataframe name is df. It has two columns called title and url.
I am using requests to read the url. I can able to read the image using for loop. However, it prints only one image. I need to print all 10 images. Any suggestions?
for i in df['url']:
response = requests.get(i)
img = Image.open(BytesIO(response.content))
plt.imshow(img)
Output:
It prints only one image. I wanted to print all 10 images
Upvotes: 1
Views: 3112
Reputation: 338
Just add plt.show() :
for i in df['url']:
response = requests.get(i)
img = Image.open(BytesIO(response.content))
plt.imshow(img)
plt.show()
Upvotes: 2
Reputation: 321
i think it opens all of them and you see only the last one, because its in the same opener "img", put a print to check your iteration...
Upvotes: 1