Created
June 4, 2020 20:26
-
-
Save shinokada/3a92351442c5b15c8a30f9a606f153a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plotly.graph_objects as go | |
import pandas as pd | |
daily_us_url = 'https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports_us/04-21-2020.csv' | |
df = pd.read_csv(daily_us_url) | |
df = df.dropna(axis=0, subset=['Lat']) | |
df = df.fillna(0) | |
df['text'] = df['Province_State'] + ': ' + df['Active'].astype(int).astype(str) | |
df['Active'] = df['Active']/3000 | |
df['Active'] = df['Active'].astype(int) | |
fig = go.Figure(data=go.Scattergeo( | |
lon=df['Long_'], | |
lat=df['Lat'], | |
text=df['text'], | |
mode='markers', | |
marker_color=df['Active'], | |
marker=dict( | |
size=df['Active'], | |
# https://plotly.github.io/plotly.py-docs/generated/plotly.graph_objects.Scattergeo.html#plotly.graph_objects.scattergeo.Marker.colorscale | |
colorscale='jet', | |
showscale=True | |
) | |
)) | |
fig.update_layout( | |
title='COVOD-19 daily reports of active patients in USA by states', | |
geo=dict( | |
scope='usa', | |
), | |
) | |
fig.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment