home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 1228267515

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/6953#issuecomment-1228267515 https://api.github.com/repos/pydata/xarray/issues/6953 1228267515 IC_kwDOAMm_X85JNd_7 28786187 2022-08-26T09:22:21Z 2022-08-26T09:22:21Z CONTRIBUTOR

@mathause Thanks, that works for np.median, but .reduce() passes an axis= keyword argument, which needs to be taken care of by any custom function. I used np.median here just as an example, as it showed the problem.

@dcherian I am not sure if raising an error would be very user friendly. In my opinion, which may be biased by my personal use cases, I would expect .apply() (or .map() for that matter) of a resample object to take any function that returns a scalar: the value at the resampled point. It should be then up to xarray to iterate over any other non-resampled dimensions. I am not sure why it requires to return a DataArray in the first place. As mentioned, it works with pandas series and dataframes, e.g.:

python data.to_pandas().resample("M").apply(np.median)

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