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/1074#issuecomment-1303907119,https://api.github.com/repos/pydata/xarray/issues/1074,1303907119,IC_kwDOAMm_X85NuAsv,103256364,2022-11-04T17:18:57Z,2022-11-04T17:18:57Z,NONE,"I want to apply a function over a given axis. This functionality is well defined and not covered by pipe (well, you can select the axis INSIDE the function passed, but it's bad practice because that means the function has an extra parameter to select the axis, not very KISS imo)","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-873026293,https://api.github.com/repos/pydata/xarray/issues/1074,873026293,MDEyOklzc3VlQ29tbWVudDg3MzAyNjI5Mw==,61931826,2021-07-02T14:07:05Z,2021-07-02T14:08:22Z,NONE,Not stale! Why not follow the pd convention of map vs apply for dataarray vs dataset?,"{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-457306964,https://api.github.com/repos/pydata/xarray/issues/1074,457306964,MDEyOklzc3VlQ29tbWVudDQ1NzMwNjk2NA==,26384082,2019-01-24T18:33:55Z,2019-01-24T18:33:55Z,NONE,"In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity
If this issue remains relevant, please comment here; otherwise it will be marked as closed automatically
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-261495282,https://api.github.com/repos/pydata/xarray/issues/1074,261495282,MDEyOklzc3VlQ29tbWVudDI2MTQ5NTI4Mg==,941907,2016-11-18T10:09:48Z,2016-11-18T10:09:48Z,NONE,"Actually, I think that `pipe` should default to `raw=False` if there even is to be such a parameter. the reason is that one usually uses `pipe` to chain together functions, each of which usually expect a DataArray and ""downcasting"" to ndarray often breaks such a chain. If you insist on having one method behave as if `raw=True`, then I think it should be `apply` in order to be constsent with the python apply function which simply applies the function and nothing more.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-261316492,https://api.github.com/repos/pydata/xarray/issues/1074,261316492,MDEyOklzc3VlQ29tbWVudDI2MTMxNjQ5Mg==,1217238,2016-11-17T17:44:21Z,2016-11-17T17:44:21Z,MEMBER,"@burnpanck I missed your comments from a few weeks ago. Yes, please do make PRs to update the docs.
I am OK with adding `DataArray.apply` for consistency and discoverability, even if it's basically an alias of `DataArray.pipe`. And if we add a `raw` argument I suppose it should probably default to `raw=False` for both `.apply` methods.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-261223890,https://api.github.com/repos/pydata/xarray/issues/1074,261223890,MDEyOklzc3VlQ29tbWVudDI2MTIyMzg5MA==,941907,2016-11-17T11:29:38Z,2016-11-17T11:29:38Z,NONE,"I think #1130 is related. I also think that `apply` is somewhat synonymous to `pipe` and is a lot more understandable for people without a pandas background. It would also be more consistent to have them both named the same on both `Dataset` and `DataArray`.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-258425477,https://api.github.com/repos/pydata/xarray/issues/1074,258425477,MDEyOklzc3VlQ29tbWVudDI1ODQyNTQ3Nw==,1310437,2016-11-04T13:04:37Z,2016-11-04T13:04:37Z,CONTRIBUTOR,"As for the consistency concern, I wouldn't have expected that to be a big issue. I'd argue that most functions mapping `np.ndarray -> np.ndarray` will not mind receiving a `DataArray` instead. On the other hand, functions mapping `DataArray -> np.ndarray` would seldom prefer to receive the raw `np.ndarray`. So I see no use to the `raw` parameter (but then again, I do not know pandas and their use-case), such that my hypotetical `DataArray.apply` and the existing `DataArray.pipe` are essentially the same.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-258423515,https://api.github.com/repos/pydata/xarray/issues/1074,258423515,MDEyOklzc3VlQ29tbWVudDI1ODQyMzUxNQ==,1310437,2016-11-04T12:55:15Z,2016-11-04T12:55:15Z,CONTRIBUTOR,"Aha! For my use-case, `DataArray.pipe` is perfectly fine, I just didn't know about it. I have to admit that I know nothing about pandas. Before I learned about xarray, pandas was not interesting to me at all. My datasets are often high-dimensional which does not work well with pandas' orientation towards (one-dimensional) collections of observations. In that sense, I could rather relabel this issue (or create a new one) as a documentation problem. The API reference does not indicate the existence of `DataArray.pipe` at all (only `Dataset.pipe`, even though that one mentions it works on `DataArray`s too). Also, there could possibly be a see-also link to `pipe` from `apply`. Shall I have a go at a PR?
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181
https://github.com/pydata/xarray/issues/1074#issuecomment-258327585,https://api.github.com/repos/pydata/xarray/issues/1074,258327585,MDEyOklzc3VlQ29tbWVudDI1ODMyNzU4NQ==,1217238,2016-11-04T02:10:04Z,2016-11-04T02:10:04Z,MEMBER,"We could try to get in a simple version of this before #964.
My only concern is that the functionality here is slightly different from `Dataset.apply`, which takes functions that map `DataArray -> DataArray` or `DataArray -> numpy.ndarray`.
For `DataArray.apply`, we really want something that maps `numpy.ndarray -> numpy.ndarray`, which is now inconsistent. I guess we could pass the original DataArray to the function, but we already have a `.pipe` method for that.
This is also a concern for #964, because any new `xarray.apply` function would have similar consistency issues with `Dataset.apply`.
Two possible solutions, neither of which is fully satisfying:
- New keyword argument `raw` to `Dataset.apply`, defaulting to `False`. Works like the `raw` argument to `DataFrame.apply`. If `raw=True`, then `Dataset.apply` passes unlabeled arrays to the provided function, like `DataArray.apply`. This makes the difference a little less jarring.
- Pick a new name for one of these uses of `apply`, e.g., `apply_raw` for this use case. `xarray.apply_raw` or `DataArray.apply_raw` is pretty verbose, though.
","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,186868181