{"id":10327,"library":"ucimlrepo","title":"UCI ML Repository Python Wrapper","description":"The `ucimlrepo` library provides a simple interface to programmatically fetch and load datasets from the UC Irvine Machine Learning Repository directly into Python scripts and notebooks. It retrieves data, metadata, and variable information, primarily returning data as pandas DataFrames. As of version 0.0.7, it is actively maintained with a relatively stable but evolving API, ideal for machine learning and data science workflows.","status":"active","version":"0.0.7","language":"en","source_language":"en","source_url":"https://github.com/uci-ml-repo/ucimlrepo/tree/main","tags":["machine-learning","data-science","datasets","uci-ml-repository"],"install":[{"cmd":"pip install ucimlrepo","lang":"bash","label":"Install ucimlrepo"}],"dependencies":[{"reason":"Required for returning dataset features and targets as DataFrame objects.","package":"pandas","optional":false}],"imports":[{"note":"The primary function `fetch_ucirepo` is directly available in the top-level package.","wrong":"import ucimlrepo.fetch_ucirepo","symbol":"fetch_ucirepo","correct":"from ucimlrepo import fetch_ucirepo"}],"quickstart":{"code":"from ucimlrepo import fetch_ucirepo\n\n# Fetch a dataset by its ID (e.g., Iris dataset, ID 53)\niris_dataset = fetch_ucirepo(id=53)\n\n# Access features (X) and targets (y) as pandas DataFrames\nX = iris_dataset.data.features\ny = iris_dataset.data.targets\n\nprint(\"Features (X) head:\\n\", X.head())\nprint(\"Targets (y) head:\\n\", y.head())\n\n# Access metadata and variable information\nprint(\"\\nMetadata:\\n\", iris_dataset.metadata)\nprint(\"\\nVariable Info:\\n\", iris_dataset.variables)\n","lang":"python","description":"This quickstart demonstrates how to fetch a dataset using its unique ID, access its features and targets as pandas DataFrames, and retrieve metadata and variable information. Replace `id=53` with the ID of any dataset from the UCI ML Repository."},"warnings":[{"fix":"Consult the latest documentation or GitHub README for the exact object structure after an upgrade. Pin your dependency version if stability is critical for your project (e.g., `ucimlrepo==0.0.7`).","message":"The library is in early development (version 0.0.x). While efforts are made for stability, API changes, particularly in the structure of the returned dataset object attributes (e.g., `dataset.data`, `dataset.metadata`, `dataset.variables`), may occur without a major version increment.","severity":"breaking","affected_versions":"All 0.0.x versions"},{"fix":"Ensure `pandas` is installed (`pip install pandas`). If you prefer NumPy arrays, convert them using the `.values` attribute (e.g., `X.values`).","message":"All fetched dataset features (`.data.features`) and targets (`.data.targets`) are consistently returned as `pandas.DataFrame` objects. Users should be prepared to work with pandas, or convert the data to NumPy arrays or other formats explicitly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Find the desired dataset's ID from the UCI ML Repository website or by using `ucimlrepo.list_available_datasets()` (if implemented and available in your version) to get a list of IDs and names.","message":"Datasets are primarily accessed by their unique integer `id` (e.g., `fetch_ucirepo(id=53)`). While the repository offers names, programmatic access relies on these IDs. Incorrect IDs will result in an error.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"The data attributes are nested. Access features as `dataset_obj.data.features` and targets as `dataset_obj.data.targets`.","cause":"Attempting to access attributes like `data`, `features`, or `targets` directly on the object returned by `fetch_ucirepo`.","error":"AttributeError: 'UCI_ML_Repo' object has no attribute 'data' (or 'features', 'targets')"},{"fix":"Install the `pandas` library: `pip install pandas`.","cause":"`ucimlrepo` depends on `pandas` to return dataset features and targets as DataFrames, but `pandas` is not installed in the current Python environment.","error":"ModuleNotFoundError: No module named 'pandas'"},{"fix":"Verify the dataset ID on the official UCI ML Repository website or consult `ucimlrepo.list_available_datasets()` if your version of the library supports listing available datasets to find the correct ID.","cause":"The provided dataset ID (X) does not correspond to an existing dataset in the UCI ML Repository, or there was a typo in the ID.","error":"ValueError: No dataset found with id X"}]}