home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 289210412

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/1326#issuecomment-289210412 https://api.github.com/repos/pydata/xarray/issues/1326 289210412 MDEyOklzc3VlQ29tbWVudDI4OTIxMDQxMg== 6815844 2017-03-25T13:03:41Z 2017-03-25T13:03:41Z MEMBER

Yes. How about the following? (I assume this is a method of xr.DataArray.)

```Python def expand_dims(self, axis=0, dim=None): """Return a new object with an additional dimension inserted at the corresponding position in the array shape.

    Parameters
    ----------
    axis : integer
        Position (amongst axes) where new axis is to be inserted.
    dim : str or None
        Name of new dimension.

    Returns
    -------
    expanded : same type as caller
        This object, but with an additional dimension.

```

I consider 2 types users; first type users always take care of the dimension order and the other just consider the dimension labels. The first type users may specify the new axis position as axis argument. The other may just pass the new dimension name regardless of its position, in which case the new dimension will be appended as the first dimension.

This API is similar to that of np.expand_dims and I believe its behavior is intuitive.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  216799807
Powered by Datasette · Queries took 161.29ms · About: xarray-datasette