Advertisement
lamiastella

Image data of dtype <U15 cannot be converted to float

Jun 23rd, 2021
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. TypeError Traceback (most recent call last)
  3. <ipython-input-6-df9959733b9a> in <module>
  4. 1 my_img = PIL.Image.open(img)
  5. ----> 2 plt.imshow(img)
  6.  
  7. /scratch3/venv/djrn/lib/python3.8/site-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, data, **kwargs)
  8. 2722 filternorm=True, filterrad=4.0, resample=None, url=None,
  9. 2723 data=None, **kwargs):
  10. -> 2724 __ret = gca().imshow(
  11. 2725 X, cmap=cmap, norm=norm, aspect=aspect,
  12. 2726 interpolation=interpolation, alpha=alpha, vmin=vmin,
  13.  
  14. /scratch3/venv/djrn/lib/python3.8/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
  15. 1436 def inner(ax, *args, data=None, **kwargs):
  16. 1437 if data is None:
  17. -> 1438 return func(ax, *map(sanitize_sequence, args), **kwargs)
  18. 1439
  19. 1440 bound = new_sig.bind(ax, *args, **kwargs)
  20.  
  21. /scratch3/venv/djrn/lib/python3.8/site-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, **kwargs)
  22. 5521 resample=resample, **kwargs)
  23. 5522
  24. -> 5523 im.set_data(X)
  25. 5524 im.set_alpha(alpha)
  26. 5525 if im.get_clip_path() is None:
  27.  
  28. /scratch3/venv/djrn/lib/python3.8/site-packages/matplotlib/image.py in set_data(self, A)
  29. 698 if (self._A.dtype != np.uint8 and
  30. 699 not np.can_cast(self._A.dtype, float, "same_kind")):
  31. --> 700 raise TypeError("Image data of dtype {} cannot be converted to "
  32. 701 "float".format(self._A.dtype))
  33. 702
  34.  
  35. TypeError: Image data of dtype <U15 cannot be converted to float
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement