Giter VIP home page Giter VIP logo

Comments (3)

ivirshup avatar ivirshup commented on July 18, 2024 1

These arrays aren't being concatenated, they are just being compared.

This is just to see if they are equal so we know whether to keep that around in the result or not. https://anndata.readthedocs.io/en/latest/concatenation.html#merging-uns


The specific use case here was comparing images. It's very possible that we should look into faster ways to compare these things. Maybe fast paths when the objects are the same, hashing, etc.

from anndata.

ivirshup avatar ivirshup commented on July 18, 2024

Think I figured out why we convert to pandas. It's because np.array_equal(..., equal_nan=True) doesn't work for some non-numeric dtypes...

Specifically:

In [6]: a = anndata.tests.helpers.gen_vstr_recarray(5, 2)

In [7]: np.array_equal(a, a, equal_nan=True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], line 1
----> 1 np.array_equal(a, a, equal_nan=True)

File <__array_function__ internals>:180, in array_equal(*args, **kwargs)

File ~/miniforge3/envs/scanpy-dev/lib/python3.11/site-packages/numpy/core/numeric.py:2465, in array_equal(a1, a2, equal_nan)
   2463     return bool(asarray(a1 == a2).all())
   2464 # Handling NaN values if equal_nan is True
-> 2465 a1nan, a2nan = isnan(a1), isnan(a2)
   2466 # NaN's occur at different locations
   2467 if not (a1nan == a2nan).all():

TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

from anndata.

giovp avatar giovp commented on July 18, 2024

while this is possibly a generic user behaviour, are we sure this shouldn't error anyway? what's the use case of concatenating arrays in uns?

from anndata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.