Coder Social home page Coder Social logo

Comments (4)

mahmoud avatar mahmoud commented on September 28, 2024

Sure! Sounds like a fine enhancement. Would you care to give it a go? Also, I'm over here wondering if a bucketized version might help make it more useful for float variables, or do you think that would make it more confusing?

from boltons.

ajmazurie avatar ajmazurie commented on September 28, 2024

I would restrict a mode function to discretized values (integers or strings). What you suggest sounds more like a histogram function, such as numpy.histogram where the user has to say if two values (such as floats) belong to the same bucket or not, either by requesting a given number of buckets or requesting a given bucket width.

I would be more than happy to contribute a patch (never done it before, so bear with me!)

from boltons.

tiwo avatar tiwo commented on September 28, 2024

Python >=3.4 comes with the statistics module, providing median, mean, mode, harmonic mean (mentioned in boltons/TODO.rst), variance/standard deviation.

Maybe this means that providing these functions in boltons isn't as urgent, or maybe it means that they can just be backported / copy-and-pasted from the standard library (I believe the Python license is compatible).

from boltons.

mahmoud avatar mahmoud commented on September 28, 2024

Hmm, the 3.4+ stdlib version is pretty simplistic. It doesn't really encapsulate the dataset-based approach (with caching, etc.). It also inexplicably introduces the complexity of sample-based statistics by applying Bessel's correction all over the place, when most simple applications are safe to presume population-based approaches. But, after stripping away those two design oversights, if you still find something worth cribbing, would be happy to include it! I still hear from many Python <3.4 boltons users all the way back to Python 2.6, and they're always happy to have more features. :)

from boltons.

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.