I am working with numpy arrays filled with strings. My goal is to assign to a slice of a first array a, values contained in a second array b of smaller size.
The implementation that I had in mind is the following:
import numpy as np
a = np.empty((10,), dtype=str)
b = np.array(['TEST' for _ in range(2)], dtype=str)
print(b)
a[1:3] = b
print(a)
print(b) returns, as expected ['TEST' 'TEST']
But then print(a) returns ['' 'T' 'T' '' '' '' '' '' '' '']. Therefore the values from b are not correctly assigned to the slice of a.
Any idea of what is causing this wizardry?
Thanks!