mlots package¶
mlots.utilities module¶
-
mlots.utilities.
from_pandas_dataframe
(d_frame=None, target=None, test_size=None, shuffle=False, random_seed=1992)¶ NAME: from_pandas_dataframe
This is a utility provided in mlots package. The function helps representing a pandas dataframe into numpy arrays.
- Parameters
d_frame (pandas.DataFrame (default None)) – The pandas DataFrame that needs to be transformed.
target (str or int (default None)) – The column name of the target (y) variable.
test_size (float or int (default None)) – The value is the percentage of the data to be split for the test set.
shuffle (bool (default False)) – If True, the data is shuffled randomly.
random_seed (int (default 1992)) – The initial seed to be used by random function.
- Returns
X_train, X_test, y_train, y_test (ndarray, ndarray, ndarray, ndarray) –
- If target is None:
only X is returned.
- If test_size is None:
no train and test split is performed.
Examples
>>> from mlots.utilities import from_pandas_dataframe >>> X_train, X_test, y_train, y_test = from_pandas_dataframe(d_frame, target="labels", test_size=0.33, shuffle=True)