Hi,
Sorry if this has already been covered, how does this function below work? Specifically, the [0] index at the end of the line
if price < genres_mean.loc[(aff, gc)][0]:
Many thanks,
David.
def label_genres(row):
“”“For each segment in genres_mean
,
labels the apps that cost less than its segment’s mean with 1
and the others with 0
.”""
aff = row["affordability"]
gc = row["genre_count"]
price = row["Price"]
if price < genres_mean.loc[(aff, gc)][0]:
return 1
else:
return 0