home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 520016328

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/3054#issuecomment-520016328 https://api.github.com/repos/pydata/xarray/issues/3054 520016328 MDEyOklzc3VlQ29tbWVudDUyMDAxNjMyOA== 6213168 2019-08-09T18:19:05Z 2019-08-09T18:19:05Z MEMBER

@yohai Iterating point by point in pure python over numpy data is horribly slow. numpy.ndarray.flat is there mostly to be used within cython/numba code. In a DataArray it's much worse than in a plain ndarray, because every time you invoke the slice operator to fetch a single element it's being applied to all coordinates too.

If you just need to iterate over the values of a DataArray, then DataArray.values.ravel().tolist() is the fastest option that I know of (ndarray.tolist() is much faster than list(ndarray)!). If you need the coords as well, then I suspect you may be doing it wrong - could you show a simple example of your use case?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  462049420
Powered by Datasette · Queries took 1.958ms · About: xarray-datasette