I have an array of flags for various types as:
Data Type1 Type2 Type3
12 1 0 0
14 0 1 0
3 0 1 0
45 0 0 1
I want to create the following array:
Data TypeName
12 Type1
14 Type2
3 Type2
45 Type3
I tried creating an empty array of type strings as:
import numpy as np
z1 = np.empty(4, np.string_)
z1[np.where(Type1=1)] = 'Type1'
But this doesn't seem to give me desired results.
Edit: I can use pandas dataframe and each row has only 1 type either Type1, Type2, Type3
Edit2: Data Type1 Type2 Type3 are column names as in pandas dataframe but I was using numpy array with the implicit names as I have pointed in the example above.
1at each row starting from the second col?