It would be to have cut
as a series method so that we can method chain. Currently, we must use pd.cut
, for example,
filled_series = df.some_series.fillna(0)
pd.cut(filled_series, 10).mean()
it would be nice to do,
df.some_series.fillna(0).cut(10).mean()
This would also help hugely with tab completion.
To have a tab-completed series method for cut
.
I'd be -0 on adding cut
as a method. cut
can currently return an ndarray, tuple, Categorical, or Series which is not conducive to chaining which would be an advantage of having cut
as a method.
@mroeschke cut, the pandas function, behaves like this, but could cut, the series method, not just have a subset of behaviours. If you're using the cut method on a series you aren't likely bothered about it returning anything other than a series.
If I'm reading the docs correctly, it is always series in - series out, given retbins
is False
(which is the default).
What are your thoughts on this?
take
Most helpful comment
take