home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

4 rows where author_association = "CONTRIBUTOR" and issue = 29136905 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 1

  • jcmgray 4

issue 1

  • Implement DataArray.idxmax() · 4 ✖

author_association 1

  • CONTRIBUTOR · 4 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
276540506 https://github.com/pydata/xarray/issues/60#issuecomment-276540506 https://api.github.com/repos/pydata/xarray/issues/60 MDEyOklzc3VlQ29tbWVudDI3NjU0MDUwNg== jcmgray 8982598 2017-02-01T00:43:52Z 2017-02-01T00:43:52Z CONTRIBUTOR

Would using obj.fillna(0) not mess with argmax if for instance all the data is negative? Could fill with the min value instead?

Ah yes true. I was slightly anticipating e.g. filling with NaT if the dim was time-like, though time types are not something I am familiar with.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement DataArray.idxmax() 29136905
276537615 https://github.com/pydata/xarray/issues/60#issuecomment-276537615 https://api.github.com/repos/pydata/xarray/issues/60 MDEyOklzc3VlQ29tbWVudDI3NjUzNzYxNQ== jcmgray 8982598 2017-02-01T00:26:24Z 2017-02-01T00:26:24Z CONTRIBUTOR

Ah yes both ways are working now, thanks. Just had a little play around with timings, and this seems like a reasonably quick way to achieve correct NaN behaviour:

```python def xr_idxmax(obj, dim): sig = ([(dim,), (dim,)], [()]) kwargs = {'axis': -1}

allna = obj.isnull().all(dim)

return apply_ufunc(gufunc_idxmax, obj.fillna(-np.inf), obj[dim],
                   signature=sig, kwargs=kwargs,
                   dask_array='allowed').where(~allna).fillna(np.nan)

```

i.e. originally replace all NaN values with -Inf, use the usual argmax, and remask the all-NaN values afterwards.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement DataArray.idxmax() 29136905
276232678 https://github.com/pydata/xarray/issues/60#issuecomment-276232678 https://api.github.com/repos/pydata/xarray/issues/60 MDEyOklzc3VlQ29tbWVudDI3NjIzMjY3OA== jcmgray 8982598 2017-01-31T00:06:02Z 2017-01-31T00:06:02Z CONTRIBUTOR

So I thought take was just the functional equivalent of fancy indexing - I spotted it in the dask api and assumed it would work but having tried it does indeed just raise a 'not implemented error'. Just as a note, with the map_blocks approach above take is working for some cases where x[inds, ] is not -- related to #1237?

Regarding edge cases: multiple maxes is presumably fine as long as user is aware it just takes the first. However, nanargmax is probably the actual desired function here, but looks like it will raise on all-nan slices. Would dropping these and then re-aligning be too much overhead?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement DataArray.idxmax() 29136905
275778443 https://github.com/pydata/xarray/issues/60#issuecomment-275778443 https://api.github.com/repos/pydata/xarray/issues/60 MDEyOklzc3VlQ29tbWVudDI3NTc3ODQ0Mw== jcmgray 8982598 2017-01-27T21:24:31Z 2017-01-27T21:24:31Z CONTRIBUTOR

Just as I am interested in having this functionality, and the new apply_ufunc is available, would something along these lines suffice?

```python from wherever import argmax, take # numpy or dask

def gufunc_idxmax(x, y, axis=None): indx = argmax(x, axis) return take(y, indx)

def idxmax(obj, dim): sig = ([(dim,), (dim,)], [()]) kwargs = {'axis': -1} return apply_ufunc(gufunc_idxmin, obj, obj[dim], signature=sig, kwargs=kwargs, dask_array='allowed') ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Implement DataArray.idxmax() 29136905

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 12.806ms · About: xarray-datasette