I am trying to plot 2 countries only so that I can compare the differences between the two but I don't know how to add it in my code?
df.plot.bar(x='country'); // it shows all the countries and its values
I just want to show two countries only.
I am trying to plot 2 countries only so that I can compare the differences between the two but I don't know how to add it in my code?
df.plot.bar(x='country'); // it shows all the countries and its values
I just want to show two countries only.
You can filter for the two countries. Assuming the two countries are called country a
and country b
:
mask = (df["Country"] == "country a") | (df["Country"] == "country b")
df[mask].plot.bar(x="country")