Closed muzakkirhussain011 closed 2 months ago
data = ['apple', 'banana', 'cherry'] ivy.array(data,dtype=object) the defauly dtype of Ivy array is float, hence we need to pass object dtype when creating a object array
Thank you for your prompt resolution. I’m closing this issue now.
Best regards
Bug Explanation
Description
When attempting to create an
ivy.array
from a list or NumPy array that contains string elements, the operation fails. This is problematic as it limits the ability to work with categorical data inivy
.Steps to Reproduce Bug
Reproduction Steps
data = ['apple', 'banana', 'cherry']
ivy.array
:ivy_array = ivy.array(data)
Expected Behavior
The expected behavior is for
ivy
to create an array object that can handle string elements, similar to how NumPy handles arrays of strings.Actual Behavior
The operation fails with the following error message:
ivy.utils.exceptions.IvyException: numpy: nested_map: numpy: nested_map: numpy: default_dtype: numpy: is_complex_dtype: numpy: as_ivy_dtype: Cannot convert to ivy dtype. apple is not supported by NumPy backend.
Environment
Environment
Ivy Version
0.0.9.0
Backend
Device
CPU