Pandas row selection with labels


I am having trouble understanding why my solution for the exercise in Introduction to Pandas/8. Selecting Rows From a DataFrame by Label Isn’t giving the me same result as a the answer.

I’ve tried selecting without including ,: for columns, but that doesn’t seem to make a difference.

My solution is saved in the screenshot as drink_companies and the official solution from dataquest is saved as drink_companies2.

Why are the values in both not the same?

The “b” in “InBev” was lowercase in my solution :man_facepalming:

1 Like

@cmondorf is correct. When I debug my code, capital letter or not is the first thing for me to check. Also I notice that your code has " ___ " in one line of code and then switch to ’ __ ’ in the other. This often may causes problems you happen to type "___ ’ . It is hard to detect the bug if you are not using a jypter notebook.

1 Like