home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

2 rows where issue = 897689314 and user = 30388627 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

  • zxdawn · 2 ✖

issue 1

  • Support `range` in `groupby_bins` · 2 ✖

author_association 1

  • NONE 2
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
851300846 https://github.com/pydata/xarray/issues/5358#issuecomment-851300846 https://api.github.com/repos/pydata/xarray/issues/5358 MDEyOklzc3VlQ29tbWVudDg1MTMwMDg0Ng== zxdawn 30388627 2021-05-31T08:12:22Z 2021-05-31T08:12:22Z NONE

@dcherian Has this method been improved in dask_groupby? Could you provide a simple example we can follow? I got lost in the dask_groupby documentation ...

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Support `range` in `groupby_bins` 897689314
845924589 https://github.com/pydata/xarray/issues/5358#issuecomment-845924589 https://api.github.com/repos/pydata/xarray/issues/5358 MDEyOklzc3VlQ29tbWVudDg0NTkyNDU4OQ== zxdawn 30388627 2021-05-21T12:44:39Z 2021-05-21T12:44:39Z NONE

@dcherian Thanks! That's simple ;) However, the groupby_bins method is a little different from binned_statistic.

binned_statistic:

All but the last (righthand-most) bin is half-open. In other words, if bins is [1, 2, 3, 4], then the first bin is [1, 2) (including 1, but excluding 2) and the second [2, 3). The last bin, however, is [3, 4], which includes 4.

groupby_bins:

right (bool, default: True) – Indicates whether the bins include the rightmost edge or not. If right == True (the default), then the bins [1,2,3,4] indicate (1,2], (2,3], (3,4].

So, let's check this shorter example: ``` from scipy.stats import binned_statistic import numpy as np import xarray as xr

--- scipy method ---

x = np.arange(10) values = x*5 statistics, _, _ = binned_statistic(x, values, statistic='min', bins=10, range=(0, 10))

--- xarray method ---

x = xr.DataArray(x) values = xr.DataArray(values) bin_res = values.groupby_bins('dim_0', bins=np.linspace(0, 10, 10), right=False, include_lowest=True).min()

print('scipy: \n', statistics) print('xarray: \n', bin_res) ```

Output: ``` scipy: [ 0. 5. 10. 15. 20. 25. 30. 35. 40. 45.]

xarray: <xarray.DataArray (dim_0_bins: 9)> array([ 0, 10, 15, 20, 25, 30, 35, 40, 45]) Coordinates: * dim_0_bins (dim_0_bins) object [0.0, 1.111) ... [8.889, 10.0) ```

The scipy method has one more value ...

Summary

These produce the same results: binned_statistic(x, values, statistic='min', bins=10, range=(0, 10)) values.groupby_bins('dim_0', bins=np.linspace(0, 10, 11), right=False, include_lowest=True).min()

Output: scipy: [ 0. 5. 10. 15. 20. 25. 30. 35. 40. 45.] xarray: <xarray.DataArray (dim_0_bins: 10)> array([ 0, 5, 10, 15, 20, 25, 30, 35, 40, 45]) Coordinates: * dim_0_bins (dim_0_bins) object [0.0, 1.0) [1.0, 2.0) ... [9.0, 10.0)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Support `range` in `groupby_bins` 897689314

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 15.289ms · About: xarray-datasette