(
    dataset, return_only="Xy"
)
return result_X, result_y
Return pandas representation of the AIF360 dataset.

    Parameters
    ----------
    dataset : aif360.datasets.BinaryLabelDataset

      AIF360 dataset to convert to a pandas representation.

    return_only : 'Xy', 'X', or 'y'

      Which part of features X or labels y to convert and return.

    Returns
    -------
    result : tuple

      - item 0: pandas Dataframe or None, features X

      - item 1: pandas Series or None, labels y
Return pandas representation of the AIF360 dataset.
Return pandas representation of the AIF360 dataset .
def dataset_to_pandas(
    dataset, return_only="Xy"
) -> Tuple[Optional[pd.Series], Optional[pd.Series]]:
    """
    Return pandas representation of the AIF360 dataset.

    Parameters
    ----------
    dataset : aif360.datasets.BinaryLabelDataset

      AIF360 dataset to convert to a pandas representation.

    return_only : 'Xy', 'X', or 'y'

      Which part of features X or labels y to convert and return.

    Returns
    -------
    result : tuple

      - item 0: pandas Dataframe or None, features X

      - item 1: pandas Series or None, labels y
    """
    if "X" in return_only:
        X = pd.DataFrame(dataset.features, columns=dataset.feature_names)
        result_X = lale.datasets.data_schemas.add_schema(X)
        assert isinstance(result_X, pd.DataFrame), type(result_X)
    else:
        result_X = None
    if "y" in return_only:
        y = pd.Series(dataset.labels.ravel(), name=dataset.label_names[0])
        result_y = lale.datasets.data_schemas.add_schema(y)
        assert isinstance(result_y, pd.Series), type(result_y)
    else:
        result_y = None
    return result_X, result_y
def dataset_to_pandas ( dataset , return_only = "Xy" ) -> Tuple [ Optional [ pd . Series ] , Optional [ pd . Series ] ] : if "X" in return_only : X = pd . DataFrame ( dataset . features , columns = dataset . feature_names ) result_X = lale . datasets . data_schemas . add_schema ( X ) assert isinstance ( result_X , pd . DataFrame ) , type ( result_X ) else : result_X = None if "y" in return_only : y = pd . Series ( dataset . labels . ravel ( ) , name = dataset . label_names [ 0 ] ) result_y = lale . datasets . data_schemas . add_schema ( y ) assert isinstance ( result_y , pd . Series ) , type ( result_y ) else : result_y = None return result_X , result_y