Skip to content

Instantly share code, notes, and snippets.

@ghtmtt
Last active April 15, 2020 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghtmtt/46cd9bd3bc3b0ada5e6af933f7856000 to your computer and use it in GitHub Desktop.
Save ghtmtt/46cd9bd3bc3b0ada5e6af933f7856000 to your computer and use it in GitHub Desktop.
import pandas as pd
import plotly.express as px
df = pd.read_csv("https://gist.github.com/ghtmtt/66164cc25a7b160cef99fa61b2feca59/raw/3034facfdecf7358934d9f0a78341c4d13f2af47/covid-pandas.csv")
col = [col for col in df.columns if '20' in col]
dfm = pd.melt(
df,
id_vars=["Province/State", "Country/Region", "continent", "Lat", "Long"],
value_vars=col,
var_name="Date",
value_name="Cases"
)
fig = px.bar(
dfm,
x="Country/Region",
y="Cases",
facet_col="continent"
)
fig.update_xaxes(matches=None)
fig.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment