diff options
author | Maxwell Bileschi <mlbileschi@google.com> | 2020-03-25 11:52:31 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-25 10:52:31 -0500 |
commit | 68439794b84836f43ec389be0e702ff64ee76d44 (patch) | |
tree | fb4c655710cb659cdec111983f5f11ea5df9ba13 /numpy/lib/user_array.py | |
parent | b03c575834a68f3a8dad5e2974ccee7fa76003ac (diff) | |
download | numpy-68439794b84836f43ec389be0e702ff64ee76d44.tar.gz |
ENH: Use TypeError in `np.array` for python consistency (#15784)
Currently, when writing something like
```
pd.DataFrame({'arr': np.array(1., 2., 3.)})
```
```
ValueError Traceback (most recent call last)
<ipython-input-1-ffdb00ae9b74> in <module>()
1 import numpy as np
2 import pandas as pd
----> 3 pd.DataFrame({'arr': np.array(1., 2., 3.)})
ValueError: only 2 non-keyword arguments accepted
```
This stack trace that doesn't include a frame for the np constructor, because the constructor is generated python code. This may lead users to look elsewhere for the issuer of the ValueError, which may create red-herrings in that folks may look elsewhere.
This changes makes it more obvious where the error is coming from.
* reflects eric-wieser's suggestion about common error messages
* Documents required non-keyword args for np.array
* Update numpy/core/src/multiarray/multiarraymodule.c
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* Update numpy/core/src/multiarray/multiarraymodule.c
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* Update numpy/core/src/multiarray/multiarraymodule.c
Co-Authored-By: Eric Wieser <wieser.eric@gmail.com>
* Update multiarraymodule.c
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
Diffstat (limited to 'numpy/lib/user_array.py')
0 files changed, 0 insertions, 0 deletions