question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Image data of dtype object cannot be converted to float

See original GitHub issue

Hello dynamo. I met this issue when trying to run the scNT-seq human hematopoiesis. What should I do to change the dtype from object to float? Thank you very much.

`%matplotlib inline

dyn.vf.jacobian(adata_labeling, regulators=[“SPI1”, “GATA1”], effectors=[“SPI1”, “GATA1”]) dyn.pl.response( adata_labeling, np.array([[“SPI1”, “GATA1”], [“GATA1”, “SPI1”], [“SPI1”, “SPI1”], [“GATA1”, “GATA1”]]), ykey=“jacobian”, log=False, drop_zero_cells=True, grid_num=25, figsize=(5, 3), save_show_or_return=“show” )

TypeError Traceback (most recent call last) Input In [88], in <cell line: 4>() 1 get_ipython().run_line_magic(‘matplotlib’, ‘inline’) 3 dyn.vf.jacobian(adata_labeling, regulators=[“SPI1”, “GATA1”], effectors=[“SPI1”, “GATA1”]) ----> 4 dyn.pl.response( 5 adata_labeling, 6 np.array([[“SPI1”, “GATA1”], [“GATA1”, “SPI1”], [“SPI1”, “SPI1”], [“GATA1”, “GATA1”]]), 7 ykey=“jacobian”, 8 log=False, 9 drop_zero_cells=True, 10 grid_num=25, 11 figsize=(5, 3), 12 save_show_or_return=“show” 13 )

File ~\AppData\Roaming\Python\Python39\site-packages\dynamo\plot\heatmaps.py:420, in response(adata, pairs_mat, xkey, ykey, log, drop_zero_cells, delay, grid_num, n_row, n_col, cmap, show_ridge, show_rug, zero_indicator, zero_line_style, zero_line_width, mean_style, fit_curve, fit_mode, curve_style, curve_lw, no_degradation, show_extent, ext_format, stacked_fraction, figsize, save_show_or_return, save_kwargs, return_data) 417 axins = inset_axes(axes[i, j], bbox_transform=axes[i, j].transAxes, **inset_dict) 419 ext_lim = (min(x_val), max(x_val), min(y_val), max(y_val)) –> 420 im = axes[i, j].imshow( 421 values, 422 interpolation=“mitchell”, 423 origin=“lower”, 424 extent=ext_lim if show_extent else None, 425 cmap=cmap, 426 ) 427 cb = fig.colorbar(im, cax=axins) 428 cb.set_alpha(1)

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib_init_.py:1361, in _preprocess_data…inner(ax, data, *args, **kwargs) 1358 @functools.wraps(func) 1359 def inner(ax, *args, data=None, **kwargs): 1360 if data is None: -> 1361 return func(ax, *map(sanitize_sequence, args), **kwargs) 1363 bound = new_sig.bind(ax, *args, **kwargs) 1364 auto_label = (bound.arguments.get(label_namer) 1365 or bound.kwargs.get(label_namer))

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib\axes_axes.py:5609, in Axes.imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, filternorm, filterrad, resample, url, **kwargs) 5604 self.set_aspect(aspect) 5605 im = mimage.AxesImage(self, cmap, norm, interpolation, origin, extent, 5606 filternorm=filternorm, filterrad=filterrad, 5607 resample=resample, **kwargs) -> 5609 im.set_data(X) 5610 im.set_alpha(alpha) 5611 if im.get_clip_path() is None: 5612 # image does not already have clipping set, clip to axes patch

File ~\AppData\Roaming\Python\Python39\site-packages\matplotlib\image.py:700, in _ImageBase.set_data(self, A) 696 self._A = cbook.safe_masked_invalid(A, copy=True) 698 if (self._A.dtype != np.uint8 and 699 not np.can_cast(self._A.dtype, float, “same_kind”)): –> 700 raise TypeError("Image data of dtype {} cannot be converted to " 701 “float”.format(self._A.dtype)) 703 if self._A.ndim == 3 and self._A.shape[-1] == 1: 704 # If just one dimension assume scalar and apply colormap 705 self._A = self._A[:, :, 0]

TypeError: Image data of dtype object cannot be converted to float`

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:24

github_iconTop GitHub Comments

1reaction
stupidstupidstupidstupidcommented, Aug 14, 2022

屏幕截图 2022-08-14 125553

Very great result.

0reactions
github-actions[bot]commented, Nov 18, 2022

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 14 days

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Image data can not convert to float - Stack Overflow
This question comes up first in the Google search for this type error, but does not have a general answer about the cause...
Read more >
TypeError: Image data of dtype object cannot be converted to ...
The data you are trying to plot ( data[i] ) contains data of type object (i.e. a string) which of course cannot be...
Read more >
TypeError: Image data of dtype object cannot be ... - Kaggle
The meaning of the error is that the image/array is empty. Verify the image filepath. Manually open the image and check. replyReply ...
Read more >
Image data of dtype object cannot be converted to float · Issue ...
Description I get the above error message after runing a very basic script Steps/Code to Reproduce import wordcloud import matplotlib.pyplot ...
Read more >
TypeError: Image data of dtype <U3 cannot be converted to float
The error is shown after the last line, plt. imshow('img'). Im new to programming and have no background of it so please help...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found