Reputation: 63
I'm trying to get value from the pandas series. Like in the arrays I'm trying to get 3. value with tempArray[3] but the code gives me where the value inside the tempArray is equal to 3.
whichPhoto = 2
testY.index[whichPhoto]-> this gives index of it
testY.get(whichPhoto) -> this gives the id where value == 2 i don't want this
testY[[whichPhoto]] -> this also gives the id where value == 2 i don't want this
testY[[testY.index[whichPhoto]]] -> this gives correct ansver but in wrong format like (id,value)
I only need a value where id is n. like in this example value of 2. array index inside the testY.
I want the value tempArray[5] not the value where tempArray is equal to 5 the code interestingly gives me the second one.
As you can see in the photo I'm trying to get the green value (76) with the index of the photo (18 in this example).
Upvotes: 0
Views: 85
Reputation: 11105
It seems you're looking for:
testY.iloc[18]
This retrieves the 19th entry in the series testY
, as opposed to the value where the index is 18
.
Documentation on iloc
: https://pandas.pydata.org/docs/reference/api/pandas.Series.iloc.html
Upvotes: 1