{ "cells": [ { "cell_type": "markdown", "id": "2192376f", "metadata": {}, "source": [ "# Art Institute of Chicago Collection\n", "\n", "Starter notebook for the Kaggle dataset in this folder. It loads `artworks.csv` with pandas and walks through quality checks and a first piece of analysis.\n", "\n", "**Files:** `artworks.csv`, `data_dictionary.csv`." ] }, { "cell_type": "markdown", "id": "0000f7f2", "metadata": {}, "source": [ "## 1. Load the data" ] }, { "cell_type": "code", "id": "4d993d70", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "import pandas as pd\n", "\n", "df = pd.read_csv(\"artworks.csv\", low_memory=False)\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": "8bbb6bae", "metadata": {}, "source": [ "## 4. Objects by department" ] }, { "cell_type": "code", "id": "96333adb", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"department_title\"].value_counts().head(12).to_frame(\"objects\")" ] }, { "cell_type": "markdown", "id": "ed9b063a", "metadata": {}, "source": [ "## 5. Creation dates" ] }, { "cell_type": "code", "id": "b7878b43", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"creation_year\"].dropna().loc[lambda s: s.between(1000, 2030)].plot(\n", " kind=\"hist\", bins=60, figsize=(10, 4), title=\"Objects by creation year\")" ] }, { "cell_type": "markdown", "id": "22d84af5", "metadata": {}, "source": [ "## 6. Medium mix" ] }, { "cell_type": "code", "id": "2ddbde45", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"medium_class\"].value_counts().head(12).to_frame(\"objects\")" ] }, { "cell_type": "markdown", "id": "71defa2a", "metadata": {}, "source": [ "## 7. Colourfulness by century" ] }, { "cell_type": "code", "id": "9d9f82d0", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.groupby(\"century\")[\"colorfulness\"].median().dropna().sort_values().tail(12)" ] }, { "cell_type": "markdown", "id": "d691292d", "metadata": {}, "source": [ "## 8. Public domain share" ] }, { "cell_type": "code", "id": "105c56e2", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.groupby(\"department_title\")[\"is_public_domain\"].mean().mul(100).round(1).sort_values(ascending=False)" ] }, { "cell_type": "markdown", "id": "635a3e0d", "metadata": {}, "source": [ "## 9. Most prolific artists" ] }, { "cell_type": "code", "id": "3bca719c", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"artist_title\"].dropna().value_counts().head(15).to_frame(\"works\")" ] }, { "cell_type": "markdown", "id": "e0be97da", "metadata": {}, "source": [ "## 10. Styles over time" ] }, { "cell_type": "code", "id": "1daf4fd8", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "pivot = (df.dropna(subset=[\"creation_decade\", \"style_title\"])\n", " .query(\"1850 <= creation_decade <= 1990\")\n", " .groupby([\"creation_decade\", \"style_title\"]).size().unstack(fill_value=0))\n", "pivot.iloc[:, :12].plot(figsize=(11, 5))" ] }, { "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 }