0

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

enter image description here

I just want to show two countries only.

Bry Zeos
  • 15
  • 3
  • Can this answer help? https://stackoverflow.com/questions/17071871/how-do-i-select-rows-from-a-dataframe-based-on-column-values – Henrik Bo Jul 22 '21 at 10:41

1 Answers1

1

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")
FredMaster
  • 1,211
  • 1
  • 15
  • 35