Format-detecting load and save.
Dispatches on the file extension to the matching loader, so one call handles ARFF, CSV, Excel, JSON, NumPy, and Parquet without the caller naming the format. Use it when the path comes from a user or a config file; call the specific loader directly when the format is known and you need its options.
Functions
load(filepath: Union[str, Path], **kwargs) -> Dataset
Load data from a file with auto-detected format based on extension.
Parameters
filepath
Union[str, Path]
Path to the data file to be loaded.
**kwargs
dict
Additional arguments passed to the specific format loader (e.g.,
delimiter for CSV, target_column for ARFF).
Returns
Dataset
Standardized dataset object containing data and metadata.
python
>>> from tuiml.datasets import load
>>> data = load('iris.arff')
>>> X, y = load('data.csv', target_column=-1)
Notes
Supported Formats:
-
.arff: Attribute-Relation File Format -
.csv,.tsv: Delimited text files -
.npy,.npz: NumPy binary formats -
.xlsx,.xls: Microsoft Excel spreadsheets -
.parquet,.pq: Apache Parquet columnar storage -
.json,.jsonl: JSON and line-delimited JSON
save(filepath: Union[str, Path], data: np.ndarray, target: Optional[np.ndarray]=None, feature_names: Optional[List[str]]=None, **kwargs)
Save data to a file with auto-detected format based on extension.
Parameters
filepath
Union[str, Path]
Output path where the file will be saved.
data
np.ndarray
Feature matrix of shape
(n_samples, n_features).
target
np.ndarray or None
= None
Target values (labels) to include.
feature_names
List[str] or None
= None
Names for the features.
**kwargs
dict
Additional arguments passed to the specific format saver.
python
>>> import numpy as np
>>> from tuiml.datasets import save
>>> X = np.random.rand(100, 4)
>>> save('my_data.parquet', X, feature_names=['f1', 'f2', 'f3', 'f4'])