The first line works, but the second doesn't:
print(np.fromfunction(lambda x, y: 10 * x + y , (3, 5), dtype=int))
print(np.fromfunction(lambda x, y: str(10 * x + y), (3, 5), dtype=str))
[[ 0 1 2 3 4]
[10 11 12 13 14]
[20 21 22 23 24]]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/cygdrive/c/Users/pafh2/OneDrive/dev/reverb/t.py", line 439, in <module>
print(np.fromfunction(lambda x, y: str(10 * x + y), (3, 5), dtype=str))
File "/usr/lib/python3.7/site-packages/numpy/core/numeric.py", line 2027, in fromfunction
args = indices(shape, dtype=dtype)
File "/usr/lib/python3.7/site-packages/numpy/core/numeric.py", line 1968, in indices
res[i] = arange(dim, dtype=dtype).reshape(
ValueError: no fill-function for data-type.
>>>
Which page of the Numpy documentation explains the difference?
StackOverflow won't let me post, telling me, "It looks like your post is mostly code; please add some more details." So now everyone has to read this pointless paragraph I've just added.
Now it says I've still not written enough "details", though I really have, so here's more added spam to appease the the StackOverflow spam-filter "A.I.".