Reputation: 1
This particular line:
img = image.load_img('content/gdrive/My Drive/Practice Machine Learning/Test/Images/' +train['Id'][i]+'.jpg', target_size=(400,400,3))
is giving me the following error:
"TypeError: must be str, not numpy.int64"
Could you guys please let me where the issue is? I'm quite new to Python.
Upvotes: 0
Views: 1481
Reputation: 2279
Try wrapping train['Id'][i]
in a str()
call. This converts the numpy.int64 type to a string so it can be concatenated.
I.e. change:
img = image.load_img('content/gdrive/My Drive/Practice Machine Learning/Test/Images/' +train['Id'][i]+'.jpg', target_size=(400,400,3))
to
img = image.load_img('content/gdrive/My Drive/Practice Machine Learning/Test/Images/' +str(train['Id'][i])+'.jpg', target_size=(400,400,3))
Upvotes: 2