How to specify the data type of array in Ipython

ipython

#1

I have created the array in python using Numpy library .

In [1]:import numpy as np

In [2]:data1=[1,2,3,4]

In [3]:arr1=np.array(data1)

In [4]:arr1

Out[4]:array([1, 2, 3, 4])

In [5]:arr.dtype
​
Out[5]:dtype('int32')

Data type of array is int32 .I want to convert it into character but I am not able to perform this.


#2

@sid100158-you can use the .astype function to convert given data type of array to any another data type.
here ,

arr.astype(np.string_)

Hope this helps!

Regards,
Hinduja