the error message for accidentally irregular arrays is confusing
See original GitHub issueSomeone using my code reported this error message, and I would have been able to track down the problem more quickly if the message had been more informative, maybe like ValueError: setting an irregularly shaped array with a non-object dtype
instead of ValueError: setting an array element with a sequence.
>>> import numpy as np
>>> np.array([[0, 1], [2]]).dtype
dtype('O')
>>> np.array([[0, 1], [2]], dtype=int).dtype
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:34 (31 by maintainers)
Top Results From Across the Web
Prevent numpy from creating a multidimensional array
Also https://github.com/numpy/numpy/issues/5303 the error message for accidentally irregular arrays is confusing .
Read more >Data Structures: Objects and Arrays - Eloquent JavaScript
The irregular occurrences of the transformation make him suspect that they might be triggered by something. For a while, he believed that it...
Read more >Rules for changing array formulas - Microsoft Support
To change or edit an array formula, you need to follow some rules, especially if you have multi-cell formulas. This article spells out...
Read more >Top 10 Most Common C++ Mistakes That Developers Make
From a logical point of view the code seems completely fine. However, adding the second element to the vector may result in reallocation...
Read more >Undefined behavior in C and C++ programs - Project Nayuki
Reading an uninitialized local variable is a compile-time error, which halts the binary code from being generated. · When an array is created...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
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
The remaining corner case(s) are now also deprecated in master, so closing. The original case currently gives:
which is probably not great, but much better than no information. Ideas for improvements welcome.
@agriffing: I think we have a pretty good pile of evidence that there’s a problem here now 😃. Any interest in having a go at a making a solution?
On Mon, Feb 9, 2015 at 8:38 AM, argriffing notifications@github.com wrote:
Nathaniel J. Smith – http://vorpus.org