I have a Panda's dataframe like the following:
And i want to get the countries where its PIB in 2007 was less than in 2002, but i couldn´t code something to do that only using Pandas built in methods without use python iterations or something like that. The most i've got is the following line:
df[df[df.year == 2007].PIB < df[df.year == 2002].PIB].country
But i get the following error:
ValueError: Can only compare identically-labeled Series objects
Till' now i've only used Pandas to filter data from different columns, but i don't know how to compare data from the same column, in this case the year. Any support is welcome.

