test
Written by- Rubel
420 times views
Solution:
@ibbs thank you! With your help I finally reached the following which seems to work:
movie = Movie()
for id in movies["tmdbId"]:
try:
m= movie.details(id)
print(m.overview)
except:
# movie ids of the csv file no longer in tmdB
pass
Solution:
I don't have enough rep to comment so I'll point this out here, it seems that you don't quite understand how for loops work. The id variable that you defined will be overwritten by the value of movies['tmdbId'] in the for loop.
As for a solution try this.
movie = Movie()
id = movie.details(int(movies.tmdbId)) # Not sure why this variables is defined?
for id in movies["tmdbId"]: # my dataframe, I am assuming this is iterable
if movie.details(int(id)): # tmdb database,
m = movie.details(int(id))
print (m.overview)
Thank you for reading the article.