pkg_pyknnclassifier.data_loading
Module Contents
Functions
|
Load data from a file path and split into features and target. |
- pkg_pyknnclassifier.data_loading.data_loading(str_of_path, target_column)[source]
Load data from a file path and split into features and target.
- Parameters:
str_of_path (str) – The file path to the dataset.
target_column (str) – The name of the column to be used as the target variable.
- Returns:
The features as a DataFrame and the target as a Series.
- Return type:
pd.DataFrame, pd.Series
- Raises:
ValueError – If the file is not found or the target_column is not present in the DataFrame.
Examples
>>> # Loading from a CSV file and selecting target column >>> features, target = data_loading('path/to/your/data.csv', 'target_column_name')