{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "OSWN0xQn6z8u", "outputId": "bb05c540-e196-49c3-cf7a-d2f4942abe52" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Collecting datasets\n", " Using cached datasets-3.6.0-py3-none-any.whl.metadata (19 kB)\n", "Collecting huggingface_hub\n", " Using cached huggingface_hub-0.33.0-py3-none-any.whl.metadata (14 kB)\n", "Collecting fsspec\n", " Downloading fsspec-2025.5.1-py3-none-any.whl.metadata (11 kB)\n", "Collecting filelock (from datasets)\n", " Using cached filelock-3.18.0-py3-none-any.whl.metadata (2.9 kB)\n", "Collecting numpy>=1.17 (from datasets)\n", " Using cached numpy-2.3.0-cp313-cp313-manylinux_2_28_x86_64.whl.metadata (62 kB)\n", "Collecting pyarrow>=15.0.0 (from datasets)\n", " Using cached pyarrow-20.0.0-cp313-cp313-manylinux_2_28_x86_64.whl.metadata (3.3 kB)\n", "Collecting dill<0.3.9,>=0.3.0 (from datasets)\n", " Using cached dill-0.3.8-py3-none-any.whl.metadata (10 kB)\n", "Collecting pandas (from datasets)\n", " Using cached pandas-2.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (91 kB)\n", "Collecting requests>=2.32.2 (from datasets)\n", " Using cached requests-2.32.4-py3-none-any.whl.metadata (4.9 kB)\n", "Collecting tqdm>=4.66.3 (from datasets)\n", " Using cached tqdm-4.67.1-py3-none-any.whl.metadata (57 kB)\n", "Collecting xxhash (from datasets)\n", " Using cached xxhash-3.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n", "Collecting multiprocess<0.70.17 (from datasets)\n", " Using cached multiprocess-0.70.16-py312-none-any.whl.metadata (7.2 kB)\n", "Collecting fsspec\n", " Using cached fsspec-2025.3.0-py3-none-any.whl.metadata (11 kB)\n", "Requirement already satisfied: packaging in ./.venv/lib/python3.13/site-packages (from datasets) (25.0)\n", "Collecting pyyaml>=5.1 (from datasets)\n", " Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)\n", "Collecting aiohttp!=4.0.0a0,!=4.0.0a1 (from fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiohttp-3.12.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.6 kB)\n", "Collecting typing-extensions>=3.7.4.3 (from huggingface_hub)\n", " Using cached typing_extensions-4.14.0-py3-none-any.whl.metadata (3.0 kB)\n", "Collecting hf-xet<2.0.0,>=1.1.2 (from huggingface_hub)\n", " Using cached hf_xet-1.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (879 bytes)\n", "Collecting aiohappyeyeballs>=2.5.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl.metadata (5.9 kB)\n", "Collecting aiosignal>=1.1.2 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached aiosignal-1.3.2-py2.py3-none-any.whl.metadata (3.8 kB)\n", "Collecting attrs>=17.3.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached attrs-25.3.0-py3-none-any.whl.metadata (10 kB)\n", "Collecting frozenlist>=1.1.1 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached frozenlist-1.7.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)\n", "Collecting multidict<7.0,>=4.5 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached multidict-6.4.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.3 kB)\n", "Collecting propcache>=0.2.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached propcache-0.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (12 kB)\n", "Collecting yarl<2.0,>=1.17.0 (from aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached yarl-1.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (73 kB)\n", "Collecting idna>=2.0 (from yarl<2.0,>=1.17.0->aiohttp!=4.0.0a0,!=4.0.0a1->fsspec[http]<=2025.3.0,>=2023.1.0->datasets)\n", " Using cached idna-3.10-py3-none-any.whl.metadata (10 kB)\n", "Collecting charset_normalizer<4,>=2 (from requests>=2.32.2->datasets)\n", " Using cached charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (35 kB)\n", "Collecting urllib3<3,>=1.21.1 (from requests>=2.32.2->datasets)\n", " Using cached urllib3-2.4.0-py3-none-any.whl.metadata (6.5 kB)\n", "Collecting certifi>=2017.4.17 (from requests>=2.32.2->datasets)\n", " Using cached certifi-2025.4.26-py3-none-any.whl.metadata (2.5 kB)\n", "Requirement already satisfied: python-dateutil>=2.8.2 in ./.venv/lib/python3.13/site-packages (from pandas->datasets) (2.9.0.post0)\n", "Collecting pytz>=2020.1 (from pandas->datasets)\n", " Using cached pytz-2025.2-py2.py3-none-any.whl.metadata (22 kB)\n", "Collecting tzdata>=2022.7 (from pandas->datasets)\n", " Using cached tzdata-2025.2-py2.py3-none-any.whl.metadata (1.4 kB)\n", "Requirement already satisfied: six>=1.5 in ./.venv/lib/python3.13/site-packages (from python-dateutil>=2.8.2->pandas->datasets) (1.17.0)\n", "Using cached datasets-3.6.0-py3-none-any.whl (491 kB)\n", "Using cached fsspec-2025.3.0-py3-none-any.whl (193 kB)\n", "Using cached dill-0.3.8-py3-none-any.whl (116 kB)\n", "Using cached multiprocess-0.70.16-py312-none-any.whl (146 kB)\n", "Using cached huggingface_hub-0.33.0-py3-none-any.whl (514 kB)\n", "Using cached hf_xet-1.1.3-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.8 MB)\n", "Using cached aiohttp-3.12.12-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.7 MB)\n", "Using cached multidict-6.4.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (222 kB)\n", "Using cached yarl-1.20.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (352 kB)\n", "Using cached aiohappyeyeballs-2.6.1-py3-none-any.whl (15 kB)\n", "Using cached aiosignal-1.3.2-py2.py3-none-any.whl (7.6 kB)\n", "Using cached attrs-25.3.0-py3-none-any.whl (63 kB)\n", "Using cached frozenlist-1.7.0-cp313-cp313-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (232 kB)\n", "Using cached idna-3.10-py3-none-any.whl (70 kB)\n", "Using cached numpy-2.3.0-cp313-cp313-manylinux_2_28_x86_64.whl (16.6 MB)\n", "Using cached propcache-0.3.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (206 kB)\n", "Using cached pyarrow-20.0.0-cp313-cp313-manylinux_2_28_x86_64.whl (42.3 MB)\n", "Using cached PyYAML-6.0.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (759 kB)\n", "Using cached requests-2.32.4-py3-none-any.whl (64 kB)\n", "Using cached charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (148 kB)\n", "Using cached urllib3-2.4.0-py3-none-any.whl (128 kB)\n", "Using cached certifi-2025.4.26-py3-none-any.whl (159 kB)\n", "Using cached tqdm-4.67.1-py3-none-any.whl (78 kB)\n", "Using cached typing_extensions-4.14.0-py3-none-any.whl (43 kB)\n", "Using cached filelock-3.18.0-py3-none-any.whl (16 kB)\n", "Using cached pandas-2.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.0 MB)\n", "Using cached pytz-2025.2-py2.py3-none-any.whl (509 kB)\n", "Using cached tzdata-2025.2-py2.py3-none-any.whl (347 kB)\n", "Using cached xxhash-3.5.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (194 kB)\n", "Installing collected packages: pytz, xxhash, urllib3, tzdata, typing-extensions, tqdm, pyyaml, pyarrow, propcache, numpy, multidict, idna, hf-xet, fsspec, frozenlist, filelock, dill, charset_normalizer, certifi, attrs, aiohappyeyeballs, yarl, requests, pandas, multiprocess, aiosignal, huggingface_hub, aiohttp, datasets\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m29/29\u001b[0m [datasets]/29\u001b[0m [datasets]ce_hub]]\n", "\u001b[1A\u001b[2KSuccessfully installed aiohappyeyeballs-2.6.1 aiohttp-3.12.12 aiosignal-1.3.2 attrs-25.3.0 certifi-2025.4.26 charset_normalizer-3.4.2 datasets-3.6.0 dill-0.3.8 filelock-3.18.0 frozenlist-1.7.0 fsspec-2025.3.0 hf-xet-1.1.3 huggingface_hub-0.33.0 idna-3.10 multidict-6.4.4 multiprocess-0.70.16 numpy-2.3.0 pandas-2.3.0 propcache-0.3.2 pyarrow-20.0.0 pytz-2025.2 pyyaml-6.0.2 requests-2.32.4 tqdm-4.67.1 typing-extensions-4.14.0 tzdata-2025.2 urllib3-2.4.0 xxhash-3.5.0 yarl-1.20.1\n" ] } ], "source": [ "!pip install -U datasets huggingface_hub fsspec" ] }, { "cell_type": "markdown", "metadata": { "id": "edF1DuNE6nSg" }, "source": [ "### 📥 Step 1: Preprocess the Data\n", "\n", "Since the dataset is hosted on Hugging Face, you can load it directly using the `load_dataset` function." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "id": "HmHDx6cU7WRG" }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/home/escher/Projects/OpenPsychometrics/2018-11-08-IPIP-FFM-data/2018-11-08-OpenPsychometrics-IPIP-FFM/.venv/lib/python3.13/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n", "Generating train split: 100%|██████████| 609204/609204 [00:00<00:00, 781185.05 examples/s]\n", "Generating validation split: 100%|██████████| 203068/203068 [00:00<00:00, 842451.01 examples/s]\n", "Generating test split: 100%|██████████| 203069/203069 [00:00<00:00, 769756.37 examples/s]\n" ] }, { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
EXT1EXT2EXT3EXT4EXT5EXT6EXT7EXT8EXT9EXT10...screenwscreenhintroelapsetestelapseendelapseIPCcountrylat_appx_lots_of_errlong_appx_lots_of_err__index_level_0__
02.02.05.04.04.01.02.04.04.02.0...1324.0745.07.02872.0171US38.0-97.0422981
12.05.05.05.02.05.02.05.03.05.0...1366.0768.070.0223.01847US38.0-97.0325363
23.03.05.01.05.01.05.05.03.04.0...1920.01080.030.0207.0101US42.8886-88.0384105821
31.05.03.05.02.04.03.05.01.05.0...1440.0960.04.0166.0101AU-37.7919145.084169213
44.03.03.03.03.02.04.03.02.03.0...1920.01200.012.0194.042US37.5402-122.3041839500
..................................................................
6091991.05.01.05.01.05.01.05.01.05.0...360.0640.06.0364.0121US38.0-97.0259178
6092004.01.04.03.04.00.05.02.04.02.0...360.0640.015.0180.0171CR9.8533-83.9023365838
6092014.02.03.02.05.01.04.02.05.02.0...400.0640.024.0519.03926US38.0-97.0131932
6092021.04.03.03.02.04.02.04.02.05.0...1368.0912.0217.0209.0172US38.0-97.0671155
6092034.02.02.03.02.01.02.05.03.05.0...1366.0768.011.0203.0121CA45.9784-66.6905121958
\n", "

609204 rows × 111 columns

\n", "
" ], "text/plain": [ " EXT1 EXT2 EXT3 EXT4 EXT5 EXT6 EXT7 EXT8 EXT9 EXT10 ... \\\n", "0 2.0 2.0 5.0 4.0 4.0 1.0 2.0 4.0 4.0 2.0 ... \n", "1 2.0 5.0 5.0 5.0 2.0 5.0 2.0 5.0 3.0 5.0 ... \n", "2 3.0 3.0 5.0 1.0 5.0 1.0 5.0 5.0 3.0 4.0 ... \n", "3 1.0 5.0 3.0 5.0 2.0 4.0 3.0 5.0 1.0 5.0 ... \n", "4 4.0 3.0 3.0 3.0 3.0 2.0 4.0 3.0 2.0 3.0 ... \n", "... ... ... ... ... ... ... ... ... ... ... ... \n", "609199 1.0 5.0 1.0 5.0 1.0 5.0 1.0 5.0 1.0 5.0 ... \n", "609200 4.0 1.0 4.0 3.0 4.0 0.0 5.0 2.0 4.0 2.0 ... \n", "609201 4.0 2.0 3.0 2.0 5.0 1.0 4.0 2.0 5.0 2.0 ... \n", "609202 1.0 4.0 3.0 3.0 2.0 4.0 2.0 4.0 2.0 5.0 ... \n", "609203 4.0 2.0 2.0 3.0 2.0 1.0 2.0 5.0 3.0 5.0 ... \n", "\n", " screenw screenh introelapse testelapse endelapse IPC country \\\n", "0 1324.0 745.0 7.0 2872.0 17 1 US \n", "1 1366.0 768.0 70.0 223.0 18 47 US \n", "2 1920.0 1080.0 30.0 207.0 10 1 US \n", "3 1440.0 960.0 4.0 166.0 10 1 AU \n", "4 1920.0 1200.0 12.0 194.0 4 2 US \n", "... ... ... ... ... ... ... ... \n", "609199 360.0 640.0 6.0 364.0 12 1 US \n", "609200 360.0 640.0 15.0 180.0 17 1 CR \n", "609201 400.0 640.0 24.0 519.0 392 6 US \n", "609202 1368.0 912.0 217.0 209.0 17 2 US \n", "609203 1366.0 768.0 11.0 203.0 12 1 CA \n", "\n", " lat_appx_lots_of_err long_appx_lots_of_err __index_level_0__ \n", "0 38.0 -97.0 422981 \n", "1 38.0 -97.0 325363 \n", "2 42.8886 -88.0384 105821 \n", "3 -37.7919 145.084 169213 \n", "4 37.5402 -122.3041 839500 \n", "... ... ... ... \n", "609199 38.0 -97.0 259178 \n", "609200 9.8533 -83.9023 365838 \n", "609201 38.0 -97.0 131932 \n", "609202 38.0 -97.0 671155 \n", "609203 45.9784 -66.6905 121958 \n", "\n", "[609204 rows x 111 columns]" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "from datasets import load_dataset\n", "\n", "# Load the dataset\n", "dataset = load_dataset(\"Tetratics/2018-11-08-OpenPsychometrics-IPIP-FFM\")\n", "\n", "# Convert to a pandas DataFrame for easier manipulation\n", "df = pd.DataFrame(dataset[\"train\"])\n", "df" ] } ], "metadata": { "colab": { "provenance": [] }, "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.3" } }, "nbformat": 4, "nbformat_minor": 0 }