1. General FAQ

The leverage you are trading with depends on the equity you have in your account. Deribit uses cross-margin auto leverage. For example: if you wish to trade with 10x leverage and want to open a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to Use Python and Folium Maps to Visualize the Coronavirus!

In this article I will be showing you how to make this map. Code included! Be sure to check out what you will be making beforehand. Linked above!

As more people visit the website, individuals are more curious as to how it was built. The answer is with using Python & a module called Folium Maps which allows you to create beautiful maps using Python 3.

To create an empty version of the map, go ahead and copy the code below:

The code above generates an empty map and saves it into an HTML file. Therefore, by going to the HTML file you will be able to see the generated folium map.

Also, you can specify the latitude and longitude that your map is focussed on when defining the map variable. (Line 4)

Folium Map
Empty Map Example

Another module that you will need is called Pandas. Pandas allows us to iterate through the Coronavirus Data that we will download. Once we are able to iterate through data, we’ll be able to place markers in the map. First of all, install Pandas with pip.

Python3 Install Folium:

After this, import pandas into your python file.

I am now reading in the CSV with the code above.

Each line in the CSV represents a different location with a certain amount of cases. Additionally, each line contains a longitude and latitude for us to mark.

Since we have the latitude and longitude of each location, we can iterate through each row and place a marker for it on the map. Remember that each row of the file represents a different location with COVID-19.

The code above will iterate through every row in the CSV and take the latitude & longitude. After taking the latitude & longitude it will add a folium marker to the map.

After doing this you can save the map as an HTML file. When you open the HTML File you will be able to see your visualization of the COVID-19 Outbreak!

Hopefully this tutorial helped you gain some sense as to what folium and pandas is.

Add a comment

Related posts:

7 Signs You May Be Creating a Culture of Fear

Fear gets immediate results. People perform when they fear for their livelihood. But stimulating productivity by preying on insecurities is a great way to ensure that team members will burn out…

Flying to Colombia with Not a Bike Bag

Traveling to major cities, figuring out the taxi/train/bus to and from the airport, then bumbling about yet another globalized concrete jungle is usually not the experience we hope for when we dream…

Housekeeping

The further I delve into coding, my code and project files have grown increasingly complex. I’ve learned that this can all get out of hand if I don’t pay attention to organization. I first started…