[Python-ideas] Have max and min functions ignore None

Michael Selik mike at selik.org
Thu Dec 31 00:51:33 EST 2015


On Wed, Dec 30, 2015 at 11:44 PM Steven D'Aprano <steve at pearwood.info>
wrote:

> On Thu, Dec 31, 2015 at 04:30:24AM +0000, Michael Selik wrote:
>
> > If that flies, then there might be room for an ``interpolate(sequence,
> > method='linear')`` which would be awesome.
>
> (I presume you're still talking about the statistics module here, not
> pandas.)
>
> What did you have in mind?
>

While the scientific community is well-served by NumPy and Pandas, there
are many users trying to do a lighter amount of data wrangling that does
not include linear algebra. In my anecdotal experience, the most common
tasks are:
1. drop records with missing/bad data
2. replace missing/bad values with a constant value
3. interpolate missing values with either a pad-forward or linear method

While NumPy often has methods doing in-place mutation, the users I'm
thinking of are generally not worried about memory size and would be better
served by pure functions.

Going back to the original topic of skipping None values. I'd like to add
that many datasets use bizarre values like all 9s or -1 or '.' or whatever
to represent missingness. So, I'm not confident there's a good
general-purpose solution more simple than comprehensions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20151231/80a04b6a/attachment.html>


More information about the Python-ideas mailing list