Question about s.loc[item]

HI all. I try to get ‘India’ frequency only in the series, but I did not use the s.loc[] method, I just use print(India), I am surprised that it works. but why? see the below code. if I put one more argument into print(), for example, print(India, USA). then it does not work.

countries = f500[‘country’]
countries_counts=countries.value_counts()
print(india)

Hi,

Can you provide more information? What is the mission and screen this is happening? What was the output?

You can take e a look in theTechnical Question Guidelines.

What I can say for now is that you either have a variable named india in your code or you printed india as a string:

print('india')

Otherwise, print(india) would raise an error.

I tried again, this time it does not work. So maybe I defined india and I deleted it, but system still have the definition. Thank you anyway!

Yes, unless you restart the kernel of leave the mission, the variable is still defined, even if you deleted the code.