Question: # Below is an api endpoint to show you all countries that speak spanish. Dive into the data and answer the following # questions: #
# Below is an api endpoint to show you all countries that speak spanish. Dive into the data and answer the following
# questions:
# Display the common name, currency symbol, population and timezone of each country that is NOT landlocked and is in
# the South American continent.
# using the latitude and longitude of the data from the query above, diplay the country information on a world map using code below
import requests
import json
the website needed is called rest countries.
# make the call to the API
#create an output file so you can see the json response that was returned by the API call
printfstatus code: rstatuscode
# Create a list of country names, longitudes, latitudes and population for all countries.
# NOTE: It is important to use these names for the map to work correctly.
names
lons
lats
population
# populate this list with the data from the api call using a loop and print out information
# per requirements in
#Plotly World Map NOTE: NO CODING NEEDED HERE!
from plotly.graphobjs import Scattergeo, Layout
from plotly import offline
data
'type': 'scattergeo',
'lon': lons,
'lat': lats,
'text':names,
'marker':
'size':p for p in population
'color':population,
'colorscale':'Viridis',
'reversescale':True,
'colorbar':title:'Population'
mylayout Layouttitle'South American Countries that are not landlocked'
fig data:data, 'layout':mylayout
offline.plotfigfilename'southamerica.html
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
