home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 165160600

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
165160600 MDU6SXNzdWUxNjUxNjA2MDA= 898 Indexing by multiple arrays inconsistent with numpy 12307589 closed 0     1 2016-07-12T19:30:53Z 2016-07-31T23:10:38Z 2016-07-31T23:10:38Z CONTRIBUTOR      

When indexing an array with multiple 1d arrays of the same length, the behavior of DataArray is different from the behavior of numpy arrays. Particularly, a 2d array is returned instead of a 1d array.

``` In [1]: import xarray as xr

In [2]: import numpy as np

In [3]: a = np.random.randn(5, 5)

In [4]: print(a[range(5), range(5)]) [ 0.92539795 0.06337135 -0.02374713 -0.6795863 -1.98749572]

In [5]: a = xr.DataArray(a)

In [6]: print(a[range(5), range(5)]) <xarray.DataArray (dim_0: 5, dim_1: 5)> array([[ 0.92539795, 0.34007445, 0.44199176, 1.29499782, -0.92076652], [ 0.23939236, 0.06337135, 0.83446803, 0.58847174, -1.08886251], [ 1.35784349, -0.51613834, -0.02374713, 1.6610402 , 0.80005739], [-0.75571607, -1.67907855, 1.29851435, -0.6795863 , -2.47751013], [-0.05817197, -1.195133 , 0.43844213, 0.29625676, -1.98749572]]) Coordinates: * dim_0 (dim_0) int64 0 1 2 3 4 * dim_1 (dim_1) int64 0 1 2 3 4

In [7]: xr.version Out[7]: '0.7.2-6-g859ddc2' ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/898/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.585ms · About: xarray-datasette