home / github

Menu
  • Search all tables
  • GraphQL API

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 936045730 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 4

  • TomNicholas 6
  • max-sixty 1
  • pep8speaks 1
  • github-actions[bot] 1

author_association 3

  • MEMBER 7
  • CONTRIBUTOR 1
  • NONE 1

issue 1

  • Add to_numpy() and as_numpy() methods · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
873238915 https://github.com/pydata/xarray/pull/5568#issuecomment-873238915 https://api.github.com/repos/pydata/xarray/issues/5568 MDEyOklzc3VlQ29tbWVudDg3MzIzODkxNQ== github-actions[bot] 41898282 2021-07-02T20:22:13Z 2021-07-21T22:06:47Z CONTRIBUTOR

Unit Test Results

6 files  ±0           6 suites  ±0   51m 2s :stopwatch: ±0s 16 202 tests ±0  14 476 :heavy_check_mark: ±0  1 726 :zzz: ±0  0 :x: ±0  90 408 runs  ±0  82 242 :heavy_check_mark: ±0  8 166 :zzz: ±0  0 :x: ±0 

Results for commit c5ee050f. ± Comparison against base commit c5ee050f.

:recycle: This comment has been updated with latest results.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
884503023 https://github.com/pydata/xarray/pull/5568#issuecomment-884503023 https://api.github.com/repos/pydata/xarray/issues/5568 IC_kwDOAMm_X840uHHv TomNicholas 35968931 2021-07-21T21:11:58Z 2021-07-21T21:11:58Z MEMBER

Okay thanks @shoyer - I've removed the type check and the attempt to call .to_numpy().

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
873482983 https://github.com/pydata/xarray/pull/5568#issuecomment-873482983 https://api.github.com/repos/pydata/xarray/issues/5568 MDEyOklzc3VlQ29tbWVudDg3MzQ4Mjk4Mw== pep8speaks 24736507 2021-07-03T23:15:29Z 2021-07-21T21:11:19Z NONE

Hello @TomNicholas! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2021-07-21 21:11:19 UTC
{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
884323982 https://github.com/pydata/xarray/pull/5568#issuecomment-884323982 https://api.github.com/repos/pydata/xarray/issues/5568 IC_kwDOAMm_X840tbaO TomNicholas 35968931 2021-07-21T16:27:54Z 2021-07-21T16:27:54Z MEMBER

The only error is the ffspec error now

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
881585044 https://github.com/pydata/xarray/pull/5568#issuecomment-881585044 https://api.github.com/repos/pydata/xarray/issues/5568 IC_kwDOAMm_X840i-uU TomNicholas 35968931 2021-07-16T16:52:56Z 2021-07-16T16:52:56Z MEMBER

@dcherian I think .to_numpy() does actually work in the case of an IndexVariable, because the underlying pandas index has that method. That's not going to be used yet, but we should perhaps leave it in to prepare for the flexible indexes?

Other than that I like your other suggestions, please commit and merge as you see fit!

On Fri, 16 Jul 2021, 10:44 Deepak Cherian, @.***> wrote:

@.**** approved this pull request.

looks great. Thanks @TomNicholas https://github.com/TomNicholas

In xarray/core/dataarray.py https://github.com/pydata/xarray/pull/5568#discussion_r671384844:

@@ -623,7 +623,7 @@ def len(self) -> int:

 @property

 def data(self) -> Any:
  • """The array's data as a dask or numpy array"""

  • """The array's data as a numpy-like array"""

⬇️ Suggested change

  • """The array's data as a numpy-like array"""

  • """

  • The DataArray's data as an array. The underlying array type

  • (e.g. dask, sparse, pint) is preserved.

+

  • See Also


  • DataArray.to_numpy

  • DataArray.as_numpy

  • DataArray.values

  • """


In xarray/core/dataarray.py https://github.com/pydata/xarray/pull/5568#discussion_r671385021:

@@ -632,13 +632,42 @@ def data(self, value: Any) -> None:

 @property

 def values(self) -> np.ndarray:
  • """The array's data as a numpy.ndarray"""

  • """

  • The array's data as a numpy.ndarray.

+

  • If the array's data is not a numpy.ndarray this will attempt to convert

  • it naively using np.array(), which will raise an error if the array

  • type does not support coercion like this.

⬇️ Suggested change

  • type does not support coercion like this.

  • type does not support coercion like this (e.g. cupy).


In xarray/core/dataarray.py https://github.com/pydata/xarray/pull/5568#discussion_r671385936:

     return self.variable.values
 @values.setter

 def values(self, value: Any) -> None:

     self.variable.values = value
  • def to_numpy(self) -> np.ndarray:

  • """

  • Coerces wrapped data to numpy and returns a numpy.ndarray.

+

  • See also


  • DataArray.as_numpy : Same but returns the surrounding DataArray instead.

  • Dataset.as_numpy

⬇️ Suggested change

  • Dataset.as_numpy

  • Dataset.as_numpy

  • DataArray.values

  • DataArray.data


In xarray/core/dataarray.py https://github.com/pydata/xarray/pull/5568#discussion_r671386127:

+

  • See also


  • DataArray.as_numpy : Same but returns the surrounding DataArray instead.

  • Dataset.as_numpy

  • """

  • return self.variable.to_numpy()

+

  • def as_numpy(self: T_DataArray) -> T_DataArray:

  • """

  • Coerces wrapped data and coordinates into numpy arrays, returning a DataArray.

+

  • See also


  • DataArray.to_numpy : Same but returns only the data as a numpy.ndarray object.

  • Dataset.as_numpy : Converts all variables in a Dataset.

⬇️ Suggested change

  • Dataset.as_numpy : Converts all variables in a Dataset.

  • Dataset.as_numpy : Converts all variables in a Dataset.

  • DataArray.values

  • DataArray.data


In xarray/core/pycompat.py https://github.com/pydata/xarray/pull/5568#discussion_r671387856:

  • self.module = duck_array_module

  • self.version = duck_array_version

  • self.type = duck_array_type

  • self.available = self.version > "0.0.0"

⬇️ Suggested change

  • self.available = self.version > "0.0.0"

  • self.available = duck_array_module is not None

v. minor: this seems cleaner?

In xarray/core/variable.py https://github.com/pydata/xarray/pull/5568#discussion_r671388121:

+dask_array_type = DuckArrayModule("dask").type

+cupy_array_type = DuckArrayModule("cupy").type

+sparse_array_type = DuckArrayModule("sparse").type

import these from pycompat as earlier?

In xarray/core/variable.py https://github.com/pydata/xarray/pull/5568#discussion_r671388613:

  • try:
  • data = data.to_numpy()

  • except AttributeError:

Isn't this always failing? Should we avoid it until such a protocol actually exists?


In xarray/core/variable.py https://github.com/pydata/xarray/pull/5568#discussion_r671389110:

@@ -1069,6 +1069,32 @@ def chunk(self, chunks={}, name=None, lock=False):

     return self._replace(data=data)
  • def to_numpy(self) -> np.ndarray:

  • """Coerces wrapped data to numpy and returns a numpy.ndarray"""

  • TODO an entrypoint so array libraries can choose coercion method?

  • data = self.data

  • try:

  • data = data.to_numpy()

  • except AttributeError:

  • if isinstance(data, dask_array_type):

  • data = self.compute().data

⬇️ Suggested change

  • data = self.compute().data

  • data = data.compute()

to match the rest?

In xarray/tests/test_variable.py https://github.com/pydata/xarray/pull/5568#discussion_r671391347:

@@ -2540,3 +2542,68 @@ def test_clip(var):

         var.mean("z").data[:, :, np.newaxis],

     ),

 )

+

+

@.***("Var", [Variable, IndexVariable])

you could stick these in VariableSubclassObjects? Could also do that later if it's a good idea

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pydata/xarray/pull/5568#pullrequestreview-708566048, or unsubscribe https://github.com/notifications/unsubscribe-auth/AISNPIYHDVQ7DOWCTQH4REDTYBOW5ANCNFSM47XKDGNQ .

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
881144228 https://github.com/pydata/xarray/pull/5568#issuecomment-881144228 https://api.github.com/repos/pydata/xarray/issues/5568 IC_kwDOAMm_X840hTGk TomNicholas 35968931 2021-07-16T03:11:44Z 2021-07-16T03:11:44Z MEMBER

The only failure is the same as in https://github.com/pydata/xarray/issues/5600 , so I think this should be ready to merge.

{
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
877399596 https://github.com/pydata/xarray/pull/5568#issuecomment-877399596 https://api.github.com/repos/pydata/xarray/issues/5568 MDEyOklzc3VlQ29tbWVudDg3NzM5OTU5Ng== TomNicholas 35968931 2021-07-09T19:08:45Z 2021-07-09T19:08:45Z MEMBER

This is actually ready for a review now @shoyer

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
873291335 https://github.com/pydata/xarray/pull/5568#issuecomment-873291335 https://api.github.com/repos/pydata/xarray/issues/5568 MDEyOklzc3VlQ29tbWVudDg3MzI5MTMzNQ== max-sixty 5635139 2021-07-02T22:50:10Z 2021-07-02T22:50:10Z MEMBER

@TomNicholas I think that should fix it. But it's become Haskell-esque!

{
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 1,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730
873240344 https://github.com/pydata/xarray/pull/5568#issuecomment-873240344 https://api.github.com/repos/pydata/xarray/issues/5568 MDEyOklzc3VlQ29tbWVudDg3MzI0MDM0NA== TomNicholas 35968931 2021-07-02T20:25:33Z 2021-07-02T20:25:33Z MEMBER

Irritating linting error:

xarray/core/variable.py:1095: error: Incompatible return value type (got "Variable", expected "VariableType") [return-value] xarray/core/dataarray.py:661: error: Incompatible return value type (got "DataArray", expected "T_DataArray") [return-value] Found 2 errors in 2 files (checked 143 source files)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  Add to_numpy() and as_numpy() methods 936045730

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