home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 394898828

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/issues/2191#issuecomment-394898828 https://api.github.com/repos/pydata/xarray/issues/2191 394898828 MDEyOklzc3VlQ29tbWVudDM5NDg5ODgyOA== 6628425 2018-06-06T00:07:10Z 2018-06-06T00:07:10Z MEMBER

Indeed what I had above is quite slow!

python In [6]: %%timeit ...: month_start = [DatetimeNoLeap(date.dt.year, date.dt.month, 1) for date in da.time] ...: 1 loop, best of 3: 588 ms per loop

Iterating over the contents of da.time generates DataArray instances encapsulating single dates. We can iterate over the dates themselves directly, which is much (over 1000x) faster:

python In [7]: %%timeit ...: month_start = [DatetimeNoLeap(date.year, date.month, 1) for date in da.time.values] ...: 1000 loops, best of 3: 302 µs per loop

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