median of np.matrix is broken
See original GitHub issue>>> import numpy as np
>>> a = np.matrix([[0, 1, 2]])
>>> np.mean(a)
1.0
>>> np.median(a)
Traceback (most recent call last):
[...]
/numpy/core/fromnumeric.py", line 619, in partition
a.partition(kth, axis=axis, kind=kind, order=order)
ValueError: kth(=1) out of bounds (1)
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to use the NumPy median function - Sharp Sight
The NumPy median function computes the median of the values in a NumPy array. Note that the NumPy median function will also operate...
Read more >Numpy median-of-means computation across unequal-sized ...
This program works fine if b divides m since np.array_split() results in partitioning the indices in equal parts and array buckets is a...
Read more >How to Use median() in NumPy? - Spark by {Examples}
Python NumPy median() function is used to compute the median of the given NumPy array over the specified axis or multiple axes.
Read more >numpy.median() in Python - GeeksforGeeks
Parameters : arr : [array_like]input array. axis : [int or tuples of int]axis along which we want to calculate the median. Otherwise ...
Read more >numpy.median — NumPy v1.24 Manual
Axis or axes along which the medians are computed. The default is to compute the median along a flattened version of the array....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reproducing Bug:
This bug seems to exist when we compute median for NumPy matrix, and that too when we don’t specify the axis.
for numpy array, it flattens the array and computes the median but for the matrix it’s not.
Heh, still present in 1.12.