Relation between tags

I try to understand below code. what we are doing here? why we have 2 tags inside[]?

Thank you!

Screen Link: https://app.dataquest.io/m/469/guided-project%3A-popular-data-science-questions/10/just-a-fad

My Code:


associations.fillna(0, inplace=True)

for tags in questions["Tags"]:
    associations.loc[tags, tags] += 1

Is this code written by you? I need the source of code.

No! I found this on the solution.

Hi @candiceliu93,

I just checked the solution page. The reason we are using 2 tags ( associations.loc[tags, tags] += 1) is because the row and column names are the same in the associations data frame. This will allow us to target the values that have the same row name and column name.

Shared with CloudApp

Best,
Sahil

2 Likes