Comments (2)
Note that on python 3.12 and higher this will actually start to work because it will not use hasattr
anymore (which, by calling getattr
, evaluates properties / descriptors).
See also #8605
from xarray.
Isn't this a bug in sparse?
import numpy as np
import numpy.array_api as xp
import sparse
a_np = np.array(['a', 'b']).astype(object)
a_sparse = sparse.COO(a_np)
print(a_np.real) # works
print(a_sparse.real) # ValueError: invalid literal for int() with base 10: 'a'
a_xp = xp.asarray(a_np) # TypeError: The array_api namespace does not support the dtype 'object'
is_duck_array
looks like this:
Lines 262 to 273 in c9ba2be
It is simply not true that namedarray only needs these for everything to work as namedarray use
.real
, .imag
etc.The true minimum requirement is
_arrayfunction_or_api
.
By using _arrayfunction_or_api
you will guarantee that mypy finds places where namedarray uses more methods than the requirement and this happens quite often as there are many places where we assume (incorrectly?) numpy arrays are used.
from xarray.
Related Issues (20)
- combine_first() fails when DataArrays are read from netcdf HOT 2
- xr.cftime_range fails when using proleptic_gregorian calendar in cftime.datetime object HOT 2
- When opening a zipped Dataset stored under Zarr on a s3 bucket, `botocore.exceptions.NoCredentialsError: Unable to locate credentials` HOT 2
- netCDF4 indexing: `reindex_like` is very slow if dataset not loaded into memory HOT 4
- Mapping DataTree methods over nodes with variables for which the args are invalid
- ENH: Make `_to_dataframe` faster for extension array columns after `pandas` fix
- `isel(multi_index_level_name = MultiIndex.level)` corrupts the MultiIndex HOT 1
- netCDF encoding and decoding issues. HOT 7
- DataArray .rolling() unclear behaviour when center=False HOT 3
- Dataset constructor always coerces 1D data variables with same name as dim to coordinates HOT 10
- datatree ops.py migration cleanup
- Support concurrent loading of variables HOT 4
- HTML repr for chunked variables with high dimensionality HOT 1
- Example code in the documentation for `Dataset` is not clear HOT 13
- Xarray sponsorship guidelines HOT 3
- Nightly Hypothesis tests failed
- update `to_netcdf` docstring to list support for explicit CDF5 writes HOT 4
- (i)loc slicer specialization for convenient slicing by dimension label as `.loc('dim_name')[:n]`
- Improving performance of open_datatree HOT 4
- Why does xr.apply_ufunc support numpy/dask.arrays?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xarray.