{ "cells": [ { "cell_type": "code", "execution_count": 72, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd\n", "import seaborn as sns\n", "import os\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 73, "outputs": [], "source": [ "agg_df = pd.DataFrame()\n", "\n", "workdir_path = 'wos_downloads/aggregated'\n", "for root, dirs, files in os.walk(workdir_path):\n", " for filename in files:\n", " if 'analyze_' in filename:\n", " path=os.path.join(root, filename)\n", " with open(os.path.join(root, 'query.txt'),'r') as f:\n", " query = f.readline()\n", " chunk = pd.read_csv(path, sep='\\t')[[\"Publication Years\",\"Record Count\"]]\n", " chunk[\"name\"] = filename.replace(\".txt\",\"\")\n", " chunk[\"query\"] = query\n", " agg_df = pd.concat([chunk,agg_df],ignore_index=True)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 74, "outputs": [], "source": [ "agg_df[\"region\"] = agg_df[\"query\"].apply(lambda x: \"EU+China\" if \"CU\" in x else \"Global\")\n", "agg_df[\"kw_token\"] = agg_df[\"query\"].apply(lambda x: x.split(\"TS=(\")[-1].split(\")\")[0])\n", "agg_df[\"kw_token\"] = agg_df[\"kw_token\"].apply(lambda x: \"OR COMPOSITE\" if \" OR \" in x else x)" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 83, "outputs": [], "source": [ "agg_df = agg_df[~agg_df[\"Record Count\"].isna()]" ], "metadata": { "collapsed": false } }, { "cell_type": "code", "execution_count": 62, "outputs": [ { "data": { "text/plain": " query Record Count\n0 CU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... 972.0\n1 CU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... 451.0\n2 CU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... 12.0\n3 CU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... 5.0\n4 CU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... 2631.0\n.. ... ...\n275 TS=(\"ubiquitous computing\") AND PY=(2011-2022) 3655.0\n276 TS=(\"unstructured data*\") AND PY=(2011-2022) 3386.0\n277 TS=(\"unsupervised deep learning\") AND PY=(2011... 728.0\n278 TS=(\"word embedding*\") AND PY=(2011-2022) 7068.0\n279 TS=(\"word vector*\") AND PY=(2011-2022) 1747.0\n\n[280 rows x 2 columns]", "text/html": "
\n | query | \nRecord Count | \n
---|---|---|
0 | \nCU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... | \n972.0 | \n
1 | \nCU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... | \n451.0 | \n
2 | \nCU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... | \n12.0 | \n
3 | \nCU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... | \n5.0 | \n
4 | \nCU=(PEOPLES R CHINA OR HONG KONG) AND CU=(AUST... | \n2631.0 | \n
... | \n... | \n... | \n
275 | \nTS=(\"ubiquitous computing\") AND PY=(2011-2022) | \n3655.0 | \n
276 | \nTS=(\"unstructured data*\") AND PY=(2011-2022) | \n3386.0 | \n
277 | \nTS=(\"unsupervised deep learning\") AND PY=(2011... | \n728.0 | \n
278 | \nTS=(\"word embedding*\") AND PY=(2011-2022) | \n7068.0 | \n
279 | \nTS=(\"word vector*\") AND PY=(2011-2022) | \n1747.0 | \n
280 rows × 2 columns
\n