I've been looking someway to compare an specific array item using numpy.where
. I have a pandas Dataframe as follow:
Id City UF
0 1 [5057, Itu, 26] [26, São Paulo]
1 2 [5366, Sorocaba, 26] None
2 3 [5347, São Paulo, 26] [26, São Paulo]
3 4 [3288, Curitiba, 18] [18, Paraná]
4 5 [162, Manaus, 3] [3, Amazonas]
I want to compare, for each line, the third item from array City with first item from array UF. I've tried like this:
np.where((pdf.loc[pdf['Cidade']:, 2] == pdf.loc[pdf['UF']:, 0]), True, False)
But had no success. Every similar sample i've found is about comparing the entire array.
here are some links i'd checked here also here
Thanks in advice.