I have a string of data data = "1,Hey,234,4456,789"
that I want to convert into a numpy array. Whenever I try the code numpy.fromstring(data,dtype=str,sep=",")
, I get the error "ValueError: zero-valued itemsize". What is the correct way to use this function so that it works as intended? The output I am trying to get is np.array(['1','Hey','234','4456','789'])
. Thanks!
Join the Stack Overflow Community
Stack Overflow is a community of 6.6 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up
Join them; it only takes a minute:
|
|||
|
Just turn the string into a list of strings (with
|
|||||
|
|
|||
|