data_preprocess.py
def remove_invalid_data(data,target):
    """
    Function that removes columns that aren't suitable for machine learning.
    This includes features with more than 10% missing values, wrong data type,
    and the indices.

    Args:
        data: DataFrame that contains data that hasn't been preprocessed.
        target: The dependent variable of the dataset

    Returns:
        DataFrame: Preprocessed DataFrame
    """    
    
    data = data[data[target].notna()]
    data = data[data.columns[data.isnull().mean()<0.1]]
    data = data.select_dtypes(exclude=['object'])
    if 'Unnamed: 0' in data.columns:
        data = data.drop('Unnamed: 0', axis = 1)
    return data

    Function that removes columns that aren't suitable for machine learning.
    This includes features with more than 10% missing values, wrong data type,
    and the indices.

    Args:
        data: DataFrame that contains data that hasn't been preprocessed.
        target: The dependent variable of the dataset

    Returns:
        DataFrame: Preprocessed DataFrame
    
Function that removes columns that aren't suitable for machine learning.
This includes features with more than 10% missing values, wrong data type,
and the indices.
Function that removes columns that aren ' t suitable for machine learning . This includes features with more than 10% missing values wrong data type and the indices .
def remove_invalid_data(data,target):
    data = data[data[target].notna()]
    data = data[data.columns[data.isnull().mean()<0.1]]
    data = data.select_dtypes(exclude=['object'])
    if 'Unnamed: 0' in data.columns:
        data = data.drop('Unnamed: 0', axis = 1)
    return data
def remove_invalid_data ( data , target ) : data = data [ data [ target ] . notna ( ) ] data = data [ data . columns [ data . isnull ( ) . mean ( ) < 0.1 ] ] data = data . select_dtypes ( exclude = [ 'object' ] ) if 'Unnamed: 0' in data . columns : data = data . drop ( 'Unnamed: 0' , axis = 1 ) return data
Function that removes columns that aren't suitable for machine learning.
Function that removes columns that aren ' t suitable for machine learning .
"""
    Function that removes columns that aren't suitable for machine learning.
    This includes features with more than 10% missing values, wrong data type,
    and the indices.

    Args:
        data: DataFrame that contains data that hasn't been preprocessed.
        target: The dependent variable of the dataset

    Returns:
        DataFrame: Preprocessed DataFrame
    """
None
DataFrame
data
DataFrame that contains data that hasn't been preprocessed.
DataFrame that contains data that hasn ' t been preprocessed .
target
The dependent variable of the dataset
The dependent variable of the dataset