Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Unable to Create ivy.array from List or NumPy Array Containing Strings #28703

Closed
4 tasks
muzakkirhussain011 opened this issue Mar 29, 2024 · 2 comments
Closed
4 tasks
Labels
Bug Report Report bugs detected in Ivy.

Comments

@muzakkirhussain011
Copy link
Contributor

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 in ivy.

Steps to Reproduce Bug

Reproduction Steps

  1. Create a list or NumPy array with string elements: data = ['apple', 'banana', 'cherry']
  2. Attempt to create an 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
  • Python version: 3.10.
  • Operating System: Ubuntu 20.04.6

Ivy Version

0.0.9.0

Backend

  • NumPy
  • TensorFlow
  • PyTorch
  • JAX

Device

CPU

@muzakkirhussain011 muzakkirhussain011 added the Bug Report Report bugs detected in Ivy. label Mar 29, 2024
@abhi2596
Copy link

abhi2596 commented Apr 9, 2024

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

@muzakkirhussain011
Copy link
Contributor Author

Thank you for your prompt resolution. I’m closing this issue now.

Best regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Report bugs detected in Ivy.
Projects
None yet
Development

No branches or pull requests

2 participants