Hi again. I completed this section but I wanted a bit more clarity/detail around a specific topic: the .loc method.
-
Outside of memorization, is there a way to understand when I am to use it? I noticed to encapsulate my boolean I need to use it. But would you be able to please explain what it means?
-
Perhaps translate one of the lines below to pseudocode/plain English, and explain what is going on requiring the syntax to be as such, please?
-
Also, can you speak on any other scenarios where it would be different than below.
I’d like as much detail as possible as I looked around but could not find what i was looking for. Happy to engage in a discussion also!
top_3_countries = f500["country"].value_counts().head(3)
industry_usa = f500.loc[f500['country']=='USA', 'industry'].value_counts().head(2)
sector_china = f500.loc[f500['country']=='China', 'sector'].value_counts().head(3)
mean_employees_japan = float(f500.loc[f500['country']=='Japan', 'employees'].mean())