I’m learning just like you! I think the issue is the way in which you try to index the column:
f500.loc[“country”]
If you’re going to specify the column with df.loc[row/s, column/s], you need to specify which row/s and then which column. So, it should look like f500.loc[:, “country”]. If you do this for both cases in your code below, it should work! Here is the official documentation on using “.loc” - https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.loc.html
(Also, the exercise is asking for Brazil ’or’ Venezuela, so it should be | instead of &).
I think there is a better way to do this however which involves less code! You can index a column simply using the name of the column like so: dataframe_name[“column_name”].
This is what it’ll look like for the “brazil_venezuela” variable:
You have to be careful about filtering columns with multiple conditions. Notice how @niaz’s answer used the bitwise operator | instead of or, and he also separated the different conditions using parenthesis.