Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(min/max)_axis(_skipnan) #68

Open
sebasv opened this issue Aug 5, 2020 · 2 comments
Open

(min/max)_axis(_skipnan) #68

sebasv opened this issue Aug 5, 2020 · 2 comments

Comments

@sebasv
Copy link

sebasv commented Aug 5, 2020

A common use case for me is taking the min or max over one axis of a multidimensional array, much like quantile_axis_mut, except I don't want to mutate my original data and I don't need the overhead of tracking quantiles. I couldn't find mentions of this idea in other issues. Will you consider a PR for such methods?
I was thinking along the lines of

pub trait QuantileExt<A, S, D>
where
    S: Data<Elem = A>,
    D: Dimension,
{
    fn min_axis_skipnan(
        &self,
        axis: Axis,
    ) -> Array<A, D::Smaller>
    where
        D: RemoveAxis,
        A: Ord + Clone + MaybeNan,
        A::NotNan: Ord;
}
@jtrawinski
Copy link

I would also find this useful. I'm currently using something like:

data.map_axis(Axis(0), |col| col.min_skipnan().clone())

@LukeMathWalker
Copy link
Member

Given that the skipnan functionality is not available in ndarray itself I'd say that this would be a good addition for convenience 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants