In Python, to get the ASCII value of a character we can do:
>>> x = ord('k')
>>> x
107
What is the equivalent Python "ord" method in NumPy? I see some solutions say to do hacks like list comprehension before passing it NumPy. However, I want a NumPy method to do the conversion. It seems there is not a way. Is there? Again, I don't want list comprehension, map, or lambda or other work-arounds. Those are all Python methods. I'm looking for the equivalent NumPy function.
EDIT: Based on Hilbert's comment, I want to convert NumPy array "x" to the ASCII equivalent using vectorized operations:
>>> a = ['g', 'h', 'i', 'j']
>>> x = np.array(a)
>>> x
array(['g', 'h', 'i', 'j'], dtype='<U1')
>>>
So if "y" were my final array (after the conversion) it would look like this:
>>> y
array([103, 104, 105, 106])
>>> type(y)
<class 'numpy.ndarray'>
>>>