Git Product home page Git Product logo

Comments (1)

bemoody avatar bemoody commented on August 15, 2024

I don't understand the "subclasses of ndarray" comment

The commit message gives slightly more explanation

commit 9c7e6e30315ab4541775d9a78630e88423c752c1
Author: Charles Harris <[email protected]>
Date:   Fri Oct 4 13:49:33 2013 -0600

    BUG: Refactor nanfunctions to behave as agreed on for 1.9.
    
        Deal with subclasses of ndarray, like pandas.Series and matrix.
    
            Subclasses may not define the new keyword keepdims or deal
            gracefully with ufuncs in all their forms. This is solved by
            throwing the problem onto the np.sum, np.any, etc. functions
            that have ugly hacks to deal with the problem.
    
        Settle handling of all-nan slices.
    
            nanmax, nanmin -- Raise warning, return NaN for slice.
            nanargmax, nanargmin -- Raise ValueError.
            nansum -- Return 0 for slice.
            nanmean, nanvar, nanstd -- Raise warning, return NaN for slice.
    
        Make NaN functions work for scalar arguments.
    
            This may seem silly, but it removes a check for special cases.
    
        Update tests
    
            Deal with new all-nan handling.
            Test with matrix class as example of subclass without keepdims.
            Test with scalar arguments.
    
        Fix nanvar issue reported in #3860.
    
        Closes #3860 #3850

Indeed, I see that pandas.Series chokes with keepdims=True. But we're not doing that so I think we should be fine with np.fmin.reduce(self.p_signal, axis=0).

If we care about object arrays, we could use np.nanargmin and np.nanargmax instead (but those are less efficient for numeric arrays.)

from wfdb-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.