How to display data in Tooltip in folium map?

Viewed 94

I need to show some data in tooltip on the map like Cases, deaths and Reported date below country name. This is my map:

A map of europe

Below the country name I want to show other data in tooltip which I got them from this code:

# Print data from JSON file

with open('DailyUpdatedReport.json') as json_file:
    data = json.load(json_file)
    for p in data['records']:
        print('Date: ' + p['dateRep'])
        print('Cases: ' + str(p['cases']))
        print('Deaths: ' + str(p['deaths']))

Example Result:

Date: 01/03/2021
Cases: 669001
Deaths: 13073

Here is my json file example:

{
   "records" : [
      {
         "dateRep" : "03/05/2021",
         "day" : "03",
         "month" : "05",
         "year" : "2021",
         "cases" : 1732,
         "deaths" : 11,
         "countriesAndTerritories" : "Austria",
         "geoId" : "AT",
         "countryterritoryCode" : "AUT",
         "popData2020" : "8901064",
         "continentExp" : "Europe"
      },

And here is my GeoJson code example:

"properties": {
    "labelrank": 4.0,
    "gu_a3": "AUT",
    "scalerank": 0,
    "income_grp": "1. High income: OECD",
    "wikipedia": -99.0,
    "woe_id": 23424750.0,
    "su_dif": 0.0,
    "pop_est": 8210281.0,
    "sovereignt": "Austria",
    "pop_year": -99.0,
    "homepart": 1.0,
    "region_wb": "Europe & Central Asia",
    "adm0_a3": "AUT",
    "continent": "Europe",
    "adm0_a3_us": "AUT",
    "gdp_md_est": 329500.0,
    "brk_name": "Austria",
    "mapcolor8": 1.0,
    "name_sort": "Austria",
    "wb_a3": "AUT",

I think I should match country code in JSON file with country code in GeoJson file but I don't know how.

0 Answers
Related