Multivariate K-Nearest Neighbors(5/12)

Screen Link:

https://app.dataquest.io/m/140/multivariate-k-nearest-neighbors/5/euclidean-distance-for-multivariate-case

My Code:

first_listiing = normalized_listings.iloc[0]['accommodates','bathrooms']
second_listing = normalized_listings.iloc[4]['accommodates','bathrooms']
first_fifth_distance = distance.euclidean(first_listing, second_listing)

first_listiing = normalized_listings.iloc[0]['accommodates','bathrooms']
second_listing = normalized_listings.iloc[4]['accommodates','bathrooms']
first_fifth_distance = distance.euclidean(first_listing, second_listing)

What I expected to happen:
Because i want to indicate iloc[row][column], I thought I didn’t have to put double [] .

What actually happened:

first_listing = normalized_listings.iloc[0][['accommodates', 'bathrooms']]
fifth_listing = normalized_listings.iloc[4][['accommodates', 'bathrooms']]
first_fifth_distance = distance.euclidean(first_listing, fifth_listing)
print(first_fifth_distance)

For a row and single column you are correct normalized_listings.iloc[0]['accommodates'] will work just fine.

But to enter multiple columns, you have to use two brackets. I believe it is so pandas sees it as a list and not a tuple.