No topics yet. Start the conversation.

Summary

User supplied summary for the plot

Unemployment rates in the Nordics from WEO

Description

The below description is supplied in free-text by the user
from novem import Plot
import sys, inspect 

# Downloading data from IMF - World Economic Outlook 2025
# See https://www.imf.org/external/datamapper/api/help for doc 
base_url = 'https://www.imf.org/external/datamapper/api/v1/'
indicator = 'LUR/' # Labourforce Unemployment Rate 

# Define the nordics using IMF 3 letter codes
nordic = {
    "NOR": "Norway",
    "DNK": "Denmark",
    "FIN": "Finland",
    "ISL": "Iceland",
    "SWE": "Sweden"
}

api_url = f"{base_url}{indicator}" + "/".join(nordic.keys())
print(api_url)
json_data = pd.read_json(api_url)
lur = json_data["values"]["LUR"]
df = pd.DataFrame.from_dict(lur, orient="index").T
df.index.name = "year"
df = df.loc["1985":"2024"]


bar_plot = Plot('imf_weo_unemployment_hist',
  name = 'Historical Unemployment rates in the Nordic countries',
  type = 'line',
  data = df, 
  summary = "Unemployment rates in the Nordics from WEO",
)

# get novem url
bar_plot.shared = 'public'
print(bar_plot.url) # https://novem.no/p/2v1rV """


bar_plot.description += '```python' + ' ' + inspect.getsource(sys.modules[__name__]) + '```' # Include this python script in Description
``````python import pandas as pd
from novem import Plot
import sys, inspect 

# Downloading data from IMF - World Economic Outlook 2025
# See https://www.imf.org/external/datamapper/api/help for doc 
base_url = 'https://www.imf.org/external/datamapper/api/v1/'
indicator = 'LUR/' # Labourforce Unemployment Rate 

# Define the nordics using IMF 3 letter codes
nordic = {
    "NOR": "Norway",
    "DNK": "Denmark",
    "FIN": "Finland",
    "ISL": "Iceland",
    "SWE": "Sweden"
}

api_url = f"{base_url}{indicator}" + "/".join(nordic.keys())
print(api_url)
json_data = pd.read_json(api_url)


# Convert from json to a pandas dataframe for the years we care bout 
lur = json_data["values"]["LUR"]
df = pd.DataFrame.from_dict(lur, orient="index").T
df.index.name = "year"
df = df.loc["1985":"2024"]
df = df.rename(columns=nordic)  # Rename columns to full country names


# Define the novem plot
bar_plot = Plot('imf_weo_unemployment_hist',
  name = 'Historical Unemployment rates in the Nordic countries',
  type = 'line',
  data = df, 
  summary = "Unemployment rates in the Nordics from WEO",
)

bar_plot.shared = 'public' # Make the plot public
print(bar_plot.url) # Print the URL 

# Include this script in description using python markup
bar_plot.description += '```python' + ' ' + inspect.getsource(sys.modules[__name__]) + '```'