{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Anthropic Economic Index: Insights from Claude 3.7 Sonnet\n", "Replication Notebook\n", "\n", "_Handa and Tamkin et al., 2025_" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [], "source": [ "import pandas as pd\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "from textwrap import wrap\n", "import numpy as np\n", "\n", "palette = sns.color_palette(\"colorblind\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Create O*NET / SOC Merged Dataframe" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [], "source": [ "def merge_onet_soc_data() -> pd.DataFrame:\n", " \"\"\"\n", " Merges O*NET task statements with SOC (Standard Occupational Classification) data\n", " based on major group codes.\n", " \n", " Args:\n", " onet_path (str): Path to the O*NET task statements CSV file\n", " soc_path (str): Path to the SOC structure CSV file\n", " \n", " Returns:\n", " pd.DataFrame: Merged DataFrame containing O*NET data with SOC major group titles\n", " \"\"\"\n", "\n", " # Read and process O*NET data\n", " onet_df = pd.read_csv(\"onet_task_statements.csv\")\n", " onet_df[\"soc_major_group\"] = onet_df[\"O*NET-SOC Code\"].str[:2]\n", " \n", " # Read and process SOC data\n", " soc_df = pd.read_csv(\"SOC_Structure.csv\")\n", " soc_df = soc_df.dropna(subset=['Major Group'])\n", " soc_df[\"soc_major_group\"] = soc_df[\"Major Group\"].str[:2]\n", " \n", " # Merge datasets\n", " merged_df = onet_df.merge(\n", " soc_df[['soc_major_group', 'SOC or O*NET-SOC 2019 Title']],\n", " on='soc_major_group',\n", " how='left'\n", " )\n", "\n", " return merged_df" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "data": { "text/plain": [ "974" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "task_occupations_df = merge_onet_soc_data()\n", "task_occupations_df[\"Title\"].nunique()" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "vscode": { "languageId": "python" } }, "outputs": [ { "data": { "text/html": [ "
| \n", " | O*NET-SOC Code | \n", "Title | \n", "Task ID | \n", "Task | \n", "Task Type | \n", "Incumbents Responding | \n", "Date | \n", "Domain Source | \n", "soc_major_group | \n", "SOC or O*NET-SOC 2019 Title | \n", "task_normalized | \n", "n_occurrences | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "11-1011.00 | \n", "Chief Executives | \n", "8823 | \n", "Direct or coordinate an organization's financi... | \n", "Core | \n", "87.0 | \n", "07/2014 | \n", "Incumbent | \n", "11 | \n", "Management Occupations | \n", "direct or coordinate an organization's financi... | \n", "1 | \n", "
| 1 | \n", "11-1011.00 | \n", "Chief Executives | \n", "8831 | \n", "Appoint department heads or managers and assig... | \n", "Core | \n", "87.0 | \n", "07/2014 | \n", "Incumbent | \n", "11 | \n", "Management Occupations | \n", "appoint department heads or managers and assig... | \n", "1 | \n", "
| 2 | \n", "11-1011.00 | \n", "Chief Executives | \n", "8825 | \n", "Analyze operations to evaluate performance of ... | \n", "Core | \n", "87.0 | \n", "07/2014 | \n", "Incumbent | \n", "11 | \n", "Management Occupations | \n", "analyze operations to evaluate performance of ... | \n", "1 | \n", "
| 3 | \n", "11-1011.00 | \n", "Chief Executives | \n", "8826 | \n", "Direct, plan, or implement policies, objective... | \n", "Core | \n", "87.0 | \n", "07/2014 | \n", "Incumbent | \n", "11 | \n", "Management Occupations | \n", "direct, plan, or implement policies, objective... | \n", "1 | \n", "
| 4 | \n", "11-1011.00 | \n", "Chief Executives | \n", "8827 | \n", "Prepare budgets for approval, including those ... | \n", "Core | \n", "87.0 | \n", "07/2014 | \n", "Incumbent | \n", "11 | \n", "Management Occupations | \n", "prepare budgets for approval, including those ... | \n", "1 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
| 19525 | \n", "53-7121.00 | \n", "Tank Car, Truck, and Ship Loaders | \n", "12806 | \n", "Test vessels for leaks, damage, and defects, a... | \n", "Supplemental | \n", "66.0 | \n", "12/2006 | \n", "Incumbent | \n", "53 | \n", "Transportation and Material Moving Occupations | \n", "test vessels for leaks, damage, and defects, a... | \n", "1 | \n", "
| 19526 | \n", "53-7121.00 | \n", "Tank Car, Truck, and Ship Loaders | \n", "12807 | \n", "Unload cars containing liquids by connecting h... | \n", "Supplemental | \n", "66.0 | \n", "12/2006 | \n", "Incumbent | \n", "53 | \n", "Transportation and Material Moving Occupations | \n", "unload cars containing liquids by connecting h... | \n", "1 | \n", "
| 19527 | \n", "53-7121.00 | \n", "Tank Car, Truck, and Ship Loaders | \n", "12808 | \n", "Copy and attach load specifications to loaded ... | \n", "Supplemental | \n", "64.0 | \n", "12/2006 | \n", "Incumbent | \n", "53 | \n", "Transportation and Material Moving Occupations | \n", "copy and attach load specifications to loaded ... | \n", "1 | \n", "
| 19528 | \n", "53-7121.00 | \n", "Tank Car, Truck, and Ship Loaders | \n", "12809 | \n", "Start pumps and adjust valves or cables to reg... | \n", "Supplemental | \n", "67.0 | \n", "12/2006 | \n", "Incumbent | \n", "53 | \n", "Transportation and Material Moving Occupations | \n", "start pumps and adjust valves or cables to reg... | \n", "1 | \n", "
| 19529 | \n", "53-7121.00 | \n", "Tank Car, Truck, and Ship Loaders | \n", "12810 | \n", "Perform general warehouse activities, such as ... | \n", "Supplemental | \n", "67.0 | \n", "12/2006 | \n", "Incumbent | \n", "53 | \n", "Transportation and Material Moving Occupations | \n", "perform general warehouse activities, such as ... | \n", "1 | \n", "
19530 rows × 12 columns
\n", "