home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

13 rows where issue = 366626025 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 5

  • M-Harrington 5
  • fujiisoup 3
  • dcherian 2
  • keewis 2
  • nedclimaterisk 1

author_association 3

  • MEMBER 7
  • NONE 5
  • CONTRIBUTOR 1

issue 1

  • Set one-dimensional data variable as dimension coordinate? · 13 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
557325914 https://github.com/pydata/xarray/issues/2461#issuecomment-557325914 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyNTkxNA== M-Harrington 42118783 2019-11-21T23:57:15Z 2019-11-21T23:57:15Z NONE

Right that's actually desired behavior to begin with so this works out

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557325065 https://github.com/pydata/xarray/issues/2461#issuecomment-557325065 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyNTA2NQ== keewis 14808389 2019-11-21T23:53:25Z 2019-11-21T23:53:25Z MEMBER

just note that in the end the result is still 2D with the missing values filled with nan

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557324294 https://github.com/pydata/xarray/issues/2461#issuecomment-557324294 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyNDI5NA== M-Harrington 42118783 2019-11-21T23:50:01Z 2019-11-21T23:50:01Z NONE

This worked perfectly, thanks so much!

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557322577 https://github.com/pydata/xarray/issues/2461#issuecomment-557322577 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyMjU3Nw== keewis 14808389 2019-11-21T23:42:28Z 2019-11-21T23:42:28Z MEMBER

to get your example to work, use this: python data=pd.DataFrame({'x': [0, 1, 2], 'y': ['a', 'b', 'c'],'z': ['a', 'b', 'c']}) xr.DataArray(data.x, coords={'y': data.y, 'x':data.z}, dims="y") to get both as dimensions, use python df = pd.DataFrame({'x': [0, 1, 2], 'y': ['a', 'b', 'c'],'z': ['a', 'b', 'c']}) ds = df.set_index(["y", "z"]).to_xarray()

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557321322 https://github.com/pydata/xarray/issues/2461#issuecomment-557321322 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyMTMyMg== M-Harrington 42118783 2019-11-21T23:37:07Z 2019-11-21T23:41:09Z NONE

This also doesn't work feeding y and z as data.y.values and data.z.values which are 1d arrays.

Ultimately merge to another dataset with the same coordinates. Seems like there's something obvious I'm missing here but I haven't been able to figure out what it is.

Ah I see in this example I need a dataset that's 3x3, let me fix the example and see if it's still relevant to my issue

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557320245 https://github.com/pydata/xarray/issues/2461#issuecomment-557320245 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMyMDI0NQ== dcherian 2448579 2019-11-21T23:33:21Z 2019-11-21T23:33:21Z MEMBER

So that's not possible. You can't have both y and z be 1D coordinate variables for x since x is 1D.

What are you ultimately trying to do after the conversion to DataArray?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557319180 https://github.com/pydata/xarray/issues/2461#issuecomment-557319180 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMxOTE4MA== M-Harrington 42118783 2019-11-21T23:29:52Z 2019-11-21T23:30:31Z NONE

@dcherian not quite because I want z and y to both have the star next to them (or bolded in your screenshot) so that they're proper coordinates. I likewise thought that the answer would be as simple as:

data=pd.DataFrame({'x': [0, 1, 2], 'y': ['a', 'b', 'c'],'z': ['a', 'b', 'c']}) xr.DataArray(data.x, coords={'y': data.y, 'x':data.z})

But again, I haven't gotten anywhere this way either and getting the error ValueError: coordinate y has dimensions ('y',), but these are not a subset of the DataArray dimensions ('dim_0',)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557315718 https://github.com/pydata/xarray/issues/2461#issuecomment-557315718 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMxNTcxOA== dcherian 2448579 2019-11-21T23:17:31Z 2019-11-21T23:17:31Z MEMBER

ds.rename_dims({"i": "y"})

Is this what you want?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
557312857 https://github.com/pydata/xarray/issues/2461#issuecomment-557312857 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDU1NzMxMjg1Nw== M-Harrington 42118783 2019-11-21T23:06:34Z 2019-11-21T23:07:32Z NONE

@fujiisoup This method works when trying to add a single coordinate, but what about when you're trying to add multiple coordinates? Example:

``` import xarray as xr ds = xr.Dataset({'x': ('i', [0, 1, 2]), 'y': ('i', ['a', 'b', 'c']),'z': ('i', ['a', 'b', 'c'])}) ds= ds.set_coords(['y','z']) ds.swap_dims({'i':'y','i':'z'}) #doesn't work

ds = xr.Dataset({'x': ('i', [0, 1, 2]), 'y': ('i', ['a', 'b', 'c']),'z': ('i', ['a', 'b', 'c'])}) ds= ds.set_coords('y') ds=ds.swap_dims({'i':'y'}) ds.set_coords('z') #doesn't work either ```

Is there any reason that this is the default behavior? This is a bit frustrating to work with after creating an xarray dataset from pandas.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
426906908 https://github.com/pydata/xarray/issues/2461#issuecomment-426906908 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDQyNjkwNjkwOA== fujiisoup 6815844 2018-10-04T06:59:56Z 2018-10-04T06:59:56Z MEMBER

It might be worth putting a "see also" note in the assign_coords and set_coords documentation for this. I tried searching quite a bit, but did not find this.

Thanks for the suggestion. It sounds a good idea. Do you mind to send a PR for this?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
426905460 https://github.com/pydata/xarray/issues/2461#issuecomment-426905460 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDQyNjkwNTQ2MA== nedclimaterisk 43126798 2018-10-04T06:53:35Z 2018-10-04T06:53:35Z CONTRIBUTOR

Awesome, thank you @fujiisoup.

It might be worth putting a "see also" note in the assign_coords and set_coords documentation for this. I tried searching quite a bit, but did not find this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
426898980 https://github.com/pydata/xarray/issues/2461#issuecomment-426898980 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDQyNjg5ODk4MA== fujiisoup 6815844 2018-10-04T06:22:03Z 2018-10-04T06:22:03Z MEMBER

I'm closing this issue, but if you have further issue, do not hesitate to reopen this.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025
426898835 https://github.com/pydata/xarray/issues/2461#issuecomment-426898835 https://api.github.com/repos/pydata/xarray/issues/2461 MDEyOklzc3VlQ29tbWVudDQyNjg5ODgzNQ== fujiisoup 6815844 2018-10-04T06:21:23Z 2018-10-04T06:21:23Z MEMBER

Hi @nedclimaterisk. Thanks for the raising an issue.

In that case, you can use swap_dims,

```python In [1]: import xarray as xr ...: ds = xr.Dataset({'x': ('i', [0, 1, 2]), 'y': ('i', ['a', 'b', 'c'])}) ...: ds ...: ...: Out[1]: <xarray.Dataset> Dimensions: (i: 3) Dimensions without coordinates: i Data variables: x (i) int64 0 1 2 y (i) <U1 'a' 'b' 'c'

In [2]: ds.swap_dims({'i': 'x'}) Out[2]: <xarray.Dataset> Dimensions: (x: 3) Coordinates: * x (x) int64 0 1 2 Data variables: y (x) <U1 'a' 'b' 'c' ```

{
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Set one-dimensional data variable as dimension coordinate? 366626025

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