![]() ![]() Now, we can create our first graph using the Plotly’s scatter_geo function. countries_week = py() countries_week = countries_week.dt.isocalendar() I achieved this by selecting only the rows with data from Sundays and then created a new column with the corresponding week number using the isocalendar method. The last preparation we need to do with our data is to organize them by week. ![]() countries = pd.merge(covid, countries_geo, how='inner', on='location') countries = pd.to_datetime(countries) countries = py() countries.fillna(0, inplace=True) After merging, I also converted the date column to datetime format and filled null values with 0. Now that we imported both datasets, let’s merge them. import pandas as pd import plotly.express as px covid = pd.read_csv('full_data.csv') covid = covid] countries_geo = pd.read_csv('countries.csv') countries_geo = countries_geo] countries_geo.columns = We’ll also need coordinates of each country, which I got from this dataset on Kaggle. The data on COVID-19 worldwide is from Our World in Data COVID-19 dataset. The first graph we’ll create is a scatter plot on a world map showing the evolution of cases through the weeks of 2020. We’ll be using COVID-19 data around the world as an example. In this article, I’ll show you how to create two graphs and put them together in a simple dashboard. Plotly Express is a tool that will let you to create awesome interactive graphs easily and, with Plotly Dash, you can use them to compose a dashboard. In order to have a better visualization of your data, you may want to gather everything in one place, creating a dashboard. Photo by Negative Space from Pexels Introduction ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |