Stuck in this Numpy Problem
country=['India','USA']
gdp=[22,33]
import numpy as np
a=np.column_stack((country,gdp))
array([['India', '22'],
['USA', '33']], dtype='<U11')
I have an NDArray and I want to find the maximum of the 2nd column. I tried the below
print(a.max(axis=1)[1])
print(a[:,1].max())
It threw this error: TypeError: cannot perform reduce with flexible type
Tried converting the type
datatype=([('country',np.str_,64),('gross',np.float32)])
new=np.array(a,dtype=datatype)
But got the below error
could not convert string to float: 'India'.