ndarray.mean() does not work with axis=None

Issue #14 resolved
Riccardo Magliocchetti created an issue

This program does not work correctly in pypy 2.4.0 and numpy git 4296d3075e6650f5b6827f4d61ee1c5f6c0e1454.

I have no clue about numpy, this code path is excercised by pdftables.

numpy reference: http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.mean.html#numpy.ndarray.mean

import numpy as np

x = np.array(['7', '31', '32', '31', '31', '31', '31', '32', '31', '31', '31', '31\
', '32', '31', '31', '31', '31', '32', '31', '31', '31', '31', '32', '31', '30'])
a = np.ndarray(shape=(2,), buffer=x)
print a.mean()

$python repro.py 3.55944329692e-67

$pypy repro.py
Traceback (most recent call last):
  File "app_main.py", line 75, in run_toplevel
  File "repro.py", line 6, in <module>
    print a.mean()
  File "/home/rm/src/pypy24venv/site-packages/numpy/core/_methods.py", line 66, in _mean
    ret = umr_sum(arr, axis, dtype, out, keepdims)
TypeError: expected integer, got NoneType object

Comments (2)

  1. Log in to comment