pydata / bottleneck

Fast NumPy array functions written in C
BSD 2-Clause "Simplified" License
1.07k stars 103 forks source link

nonreduce_axis.push to support more dtypes #349

Open kefirbandi opened 4 years ago

kefirbandi commented 4 years ago

I found that the nonreduce_axis.push only support dtypes compatible with np.nan, or for which np.isnan is supported. I'd be happy to attempt to extend the range to other types and submit a PR. But before I do that would like to know whether such a PR will be considered and what else do I need to know?

I came accross this behavior from xarray.ffill, where I wanted to forward fill string-array, but it failed.

qwhelan commented 4 years ago

@kefirbandi Absolutely would be considered given it's already in our API and there's no real equivalent in numpy. I'd suggest benchmarking any solution you have against pandas and make sure we're not slower. We'll want hypothesis testing on a variety of object types to make sure behavior is correct.

You'd want to create an object-variant of this function: https://github.com/pydata/bottleneck/blob/master/bottleneck/src/nonreduce_axis_template.c#L344

And then modify this case to get it called: https://github.com/pydata/bottleneck/blob/master/bottleneck/src/nonreduce_axis_template.c#L718

COVID-19 has meant I'm spending significantly more time on work, including on weekends, hence the lack of activity lately.