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.

1

1 Answer 1

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")
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.