Uh oh!
There was an error while loading. Please reload this page.
ENH: str accessor - #2991
Conversation
0d8f4e9 to
d7dc294Compare
shoyer
left a comment
There was a problem hiding this comment.
This needs tests, but looks like a great start!
This is getting a little long, so maybe it would make sense to split this into another module, e.g., xarray/core/str_accessor.py? The existing xarray/core/accessors.py could be renamed to xarray/core/dt_accessor.py.
| f = lambda x: x[s] | ||
| return self._apply(f) | ||
| def slice_replace(self, start=None, stop=None, repl=None): |
| def _apply(self, f): | ||
| # TODO handling of na values ? | ||
| return apply_ufunc(np.vectorize(f), self._obj) |
There was a problem hiding this comment.
Can you add dask='parallelized to add dask support? I'm pretty sure that should "just work" with these functions.
0x0L
commented
May 26, 2019
@shoyer |
shoyer
commented
May 27, 2019
You will need to reference the underlying class, e.g., |
shoyer
commented
May 27, 2019
@0x0L did you copy any of this code or tests from pandas? If so, that's totally fine, but we should include the original pandas copyright notice. See what we did in |
0x0L
commented
Jun 8, 2019
@shoyer it should be all good now |
shoyer
commented
Jun 10, 2019
thanks @0x0L ! |
* master: (31 commits) Add quantile method to GroupBy (pydata#2828) rolling_exp (nee ewm) (pydata#2650) Ensure explicitly indexed arrays are preserved (pydata#3027) add back dask-dev tests (pydata#3025) ENH: keepdims=True for xarray reductions (pydata#3033) Revert cmap fix (pydata#3038) Add "errors" keyword argument to drop() and drop_dims() (pydata#2994) (pydata#3028) More consistency checks (pydata#2859) Check types in travis (pydata#3024) Update issue templates (pydata#3019) Add pytest markers to avoid warnings (pydata#3023) Feature/merge errormsg (pydata#2971) More support for missing_value. (pydata#2973) Use flake8 rather than pycodestyle (pydata#3010) Pandas labels deprecation (pydata#3016) Pytest capture uses match, not message (pydata#3011) dask-dev tests to allowed failures in travis (pydata#3014) Fix 'to_masked_array' computing dask arrays twice (pydata#3006) str accessor (pydata#2991) fix safe_cast_to_index (pydata#3001) ...
Hello,
Some of the pandas str functionalities. Instead of wrapping pandas internal as in #2983 I copy/pasted the code since it's simple and tiny.
Currently it's a bit more restrictive than pandas since it expects all elements to be string like.
whats-new.rstfor all changes andapi.rstfor new API