Package to easily import datasets from the UC Irvine Machine Learning Repository into scripts and notebooks.
Slowing down. Last release over 2 years ago, little activity since. Fine for existing code; think twice for a new project.
pip install ucimlrepoucimlrepo package
Package to easily import datasets from the UC Irvine Machine Learning Repository into scripts and notebooks.
Current Version: 0.0.7
Installation
In a Jupyter notebook, install with the command
!pip3 install -U ucimlrepo
Restart the kernel and import the module ucimlrepo.
Example Usage
from ucimlrepo import fetch_ucirepo, list_available_datasets
# check which datasets can be imported
list_available_datasets()
# import dataset
heart_disease = fetch_ucirepo(id=45)
# alternatively: fetch_ucirepo(name='Heart Disease')
# access data
X = heart_disease.data.features
y = heart_disease.data.targets
# train model e.g. sklearn.linear_model.LinearRegression().fit(X, y)
# access metadata
print(heart_disease.metadata.uci_id)
print(heart_disease.metadata.num_instances)
print(heart_disease.metadata.additional_info.summary)
# access variable info in tabular format
print(heart_disease.variables)
fetch_ucirepo
Loads a dataset from the UCI ML Repository, including the dataframes and metadata information.
Parameters
Provide either a dataset ID or name as keyword (named) arguments. Cannot accept both.
id: Dataset ID for UCI ML Repositoryname: Dataset name, or substring of name
Returns
datasetdata: Contains dataset matrices as pandas dataframesids: Dataframe of ID columnsfeatures: Dataframe of feature columnstargets: Dataframe of target columnsoriginal: Dataframe consisting of all IDs, features, and targetsheaders: List of all variable names/headers
metadata: Contains metadata information about the dataset- See Metadata section below for details
variables: Contains variable details presented in a tabular/dataframe formatname: Variable namerole: Whether the variable is an ID, feature, or target