{ "cells": [ { "cell_type": "markdown", "id": "7ebfb0c9", "metadata": {}, "source": [ "# arXiv Preprints\n", "\n", "Starter notebook for the Kaggle dataset in this folder. It loads `arxiv_papers.csv` with pandas and walks through quality checks and a first piece of analysis.\n", "\n", "**Files:** `arxiv_papers.csv`, `data_dictionary.csv`." ] }, { "cell_type": "markdown", "id": "0000f7f2", "metadata": {}, "source": [ "## 1. Load the data" ] }, { "cell_type": "code", "id": "c61cb318", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "import pandas as pd\n", "\n", "df = pd.read_csv(\"arxiv_papers.csv\", low_memory=False)\n", "df[\"published\"] = pd.to_datetime(df[\"published\"], errors=\"coerce\")\n", "print(df.shape)" ] }, { "cell_type": "markdown", "id": "325de123", "metadata": {}, "source": [ "## 2. Shape, types and missing values" ] }, { "cell_type": "code", "id": "6eb42bc8", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "print(f\"{df.shape[0]:,} rows x {df.shape[1]} columns\")\n", "\n", "missing = df.isna().mean().mul(100).sort_values(ascending=False)\n", "missing[missing > 0].round(1).to_frame(\"missing_%\").head(15)" ] }, { "cell_type": "markdown", "id": "f2d963fe", "metadata": {}, "source": [ "## 3. Numeric summary" ] }, { "cell_type": "code", "id": "aa2f8fd4", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.describe(include='number').T.round(2).head(20)" ] }, { "cell_type": "markdown", "id": "ea6aeefb", "metadata": {}, "source": [ "## 4. Papers by primary category" ] }, { "cell_type": "code", "id": "712a02ef", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"primary_category\"].value_counts().head(15).to_frame(\"papers\")" ] }, { "cell_type": "markdown", "id": "28c0aeb0", "metadata": {}, "source": [ "## 5. Authors per paper" ] }, { "cell_type": "code", "id": "88423b62", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"author_count\"].describe().round(2).to_frame(\"authors\")" ] }, { "cell_type": "markdown", "id": "31c11707", "metadata": {}, "source": [ "## 6. Abstract length by archive" ] }, { "cell_type": "code", "id": "ec94dfb6", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.groupby(\"primary_group\")[\"abstract_words\"].median().sort_values().to_frame(\"median_words\")" ] }, { "cell_type": "markdown", "id": "69fee4b8", "metadata": {}, "source": [ "## 7. Submissions per day" ] }, { "cell_type": "code", "id": "fa59194e", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.set_index(\"published\").resample(\"D\").size().plot(figsize=(11, 4), title=\"Papers per day in the sample\")" ] }, { "cell_type": "markdown", "id": "bd3bd339", "metadata": {}, "source": [ "## 8. Published in a journal?" ] }, { "cell_type": "code", "id": "482da760", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.groupby(\"primary_group\")[[\"has_journal_ref\", \"has_doi\"]].apply(\n", " lambda t: t.apply(lambda s: (s.astype(str).str.lower() == \"true\").mean()).mul(100).round(1))" ] }, { "cell_type": "markdown", "id": "da458a70", "metadata": {}, "source": [ "## 9. Most common title words" ] }, { "cell_type": "code", "id": "dc2f4b47", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "from collections import Counter\n", "words = Counter(w.lower() for t in df[\"title\"].dropna() for w in t.split() if len(w) > 3)\n", "pd.Series(dict(words.most_common(20))).sort_values().plot.barh(figsize=(8, 6))" ] }, { "cell_type": "markdown", "id": "6e43770c", "metadata": {}, "source": [ "## Next steps\n", "\n", "See `KAGGLE.md` for analysis ideas, caveats and provenance." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11", "mimetype": "text/x-python", "file_extension": ".py", "codemirror_mode": { "name": "ipython", "version": 3 }, "pygments_lexer": "ipython3", "nbconvert_exporter": "python" } }, "nbformat": 4, "nbformat_minor": 5 }