[NumPy-Tickets] [NumPy] #1180: numpy.average: add an option to skip 'None' values from count
NumPy Trac
numpy-tickets@scipy....
Fri Mar 25 14:49:36 CDT 2011
#1180: numpy.average: add an option to skip 'None' values from count
--------------------------+-------------------------------------------------
Reporter: dalloliogm | Owner: somebody
Type: enhancement | Status: closed
Priority: normal | Milestone: Unscheduled
Component: Other | Version:
Resolution: wontfix | Keywords:
--------------------------+-------------------------------------------------
Comment(by mwiebe):
Replying to [comment:2 dalloliogm]:
> [snip]
>
> Try explaining this to a newbie who does not know what list
comprehensions are.
This is what I prefer. ;) I've made an initial attempt here:
https://github.com/numpy/numpy/commit/ac2c160c5b0ad5a420543b94a1896f5e45f67b97
If you would like to change what I have done or add similar comments to
other functions, you can use the documentation wiki. Everything you need
to get started with it is documented here:
http://docs.scipy.org/numpy/Front%20Page/
> In any case, consider that almost all the other
mathematical/statistical/data analysis languages use the method proposed
above; so, forcing people to use list comprehensions while with all the
other languages people just use a parameter would be an anomaly.
>
> Example of implementation:
>
{{{
>>> numpy.average([1, 2, None], ignore_None=True)
1.5
}}}
>
> It won't even be so difficult to implement, you can use the list
comprehension code that you wrote above.
While this is not difficult to implement, to me this doesn't fit into
NumPy and Python very well, and nudging users to learn about the powerful
features of Python that solve this more cleanly is much better.
--
Ticket URL: <http://projects.scipy.org/numpy/ticket/1180#comment:3>
NumPy <http://projects.scipy.org/numpy>
My example project
More information about the NumPy-Tickets
mailing list