home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

3 rows where issue = 415774106 sorted by updated_at descending

✖
✖

✎ View and edit SQL

This data as json, CSV (advanced)

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

user 3

  • shoyer 1
  • ahuang11 1
  • kripnerl 1

author_association 3

  • CONTRIBUTOR 1
  • MEMBER 1
  • NONE 1

issue 1

  • Add "unique()" method, mimicking pandas · 3 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
709991825 https://github.com/pydata/xarray/issues/2795#issuecomment-709991825 https://api.github.com/repos/pydata/xarray/issues/2795 MDEyOklzc3VlQ29tbWVudDcwOTk5MTgyNQ== kripnerl 38673295 2020-10-16T11:34:05Z 2020-10-16T11:34:05Z NONE

Hi, I also vote for this function, My typical use-case.

There is some structure in 3D space and I need to "flatten it" to 2D. Let us say it is axially symetric so I assign R and Z coordinate to points (or r and theta in polar). And I want to simplify this using interp; however, it requuires unique coordinates.

I have some solution here: https://stackoverflow.com/questions/51058379/drop-duplicate-times-in-xarray

and adapted this into actuall function:

```python def distribure_uniform(ds, N_points=512):

ds_theta = ds.sortby("theta").swap_dims({"idx": "theta"})
_, index = np.unique(ds_theta['theta'], return_index=True)

ds_theta = ds_theta.isel(theta=index)

ds_theta = ds_theta.interp(
    theta=np.linspace(ds.theta.min(), ds.theta.max(), N_points))

ds_theta = ds_theta.swap_dims({"theta": "idx"})
return ds_theta

```

In an idal case I would like to write something like this:

```python def distribure_uniform(ds, N_points=512):

ds_theta= ds.unique("theta", sorted=False, sort=True)

ds_theta = ds_theta.swap_dims({"idx": "theta"})
ds_theta = ds_theta.interp(
    theta=np.linspace(ds.theta.min(), ds.theta.max(), N_points))
ds_theta = ds_theta.swap_dims({"theta": "idx"})
return ds_theta

```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add "unique()" method, mimicking pandas 415774106
469477745 https://github.com/pydata/xarray/issues/2795#issuecomment-469477745 https://api.github.com/repos/pydata/xarray/issues/2795 MDEyOklzc3VlQ29tbWVudDQ2OTQ3Nzc0NQ== ahuang11 15331990 2019-03-05T00:01:58Z 2019-03-05T00:01:58Z CONTRIBUTOR

Right, it would return a 1D numpy or dask array.

I suppose I'm used to simply typing pd.Series().unique() rather than np.unique(pd.Series()).

I use it in for loops primarily. for season in da['time.season'].unique(): vs for season in np.unique(da['time.season'].data):

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add "unique()" method, mimicking pandas 415774106
469153520 https://github.com/pydata/xarray/issues/2795#issuecomment-469153520 https://api.github.com/repos/pydata/xarray/issues/2795 MDEyOklzc3VlQ29tbWVudDQ2OTE1MzUyMA== shoyer 1217238 2019-03-04T07:58:23Z 2019-03-04T07:58:23Z MEMBER

What would .unique() return on xarray.DataArray? For consistency with pandas, I guess it would return a 1D numpy or dask array?

I don't see a lot of value in adding this to xarray, given that all the xarray metadata gets lost by the unique() operation. You might as well just write np.unique(my_data_array.data).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add "unique()" method, mimicking pandas 415774106

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 16.439ms · About: xarray-datasette
  • Sort ascending
  • Sort descending
  • Facet by this
  • Hide this column
  • Show all columns
  • Show not-blank rows