def dataframe_to_arrays(dataframe, input_cols, output_cols, categorical_cols):
    """
    Convert DataFrame to numpy array. 
    Parameters
    ----------
    dataframe        : pd.DataFrame
    input_cols       : list
    output_cols      : list
    categorical_cols : list

    Returns 
    -------
    numpyArrays
    """
    # Make a copy of the original dataframe
    dataframe1 = dataframe.copy(deep=True)
    # # Convert non-numeric categorical columns to numbers
    for col in categorical_cols:
        dataframe1[col] = dataframe1[col].astype('category').cat.codes
    # Extract input & outupts as numpy arrays
    inputs_array = dataframe1[input_cols].to_numpy()
    targets_array = dataframe1[output_cols].to_numpy()
    return inputs_array, targets_array