feature-engineering-and-data-transformations/using-toy-exmaples/feature_cleaning/missing_data.py
def add_var_denote_NA(data,NA_col=[]):
    """
    creating an additional variable indicating whether the data 
    was missing for that observation (1) or not (0).
    """
  
    data_copy = data.copy(deep=True)
    for i in NA_col:
        if data_copy[i].isnull().sum()>0:
            data_copy[i+'_is_NA'] = np.where(data_copy[i].isnull(),1,0)
        else:
            warn("Column %s has no missing cases" % i)
            
    return data_copy

    creating an additional variable indicating whether the data 
    was missing for that observation (1) or not (0).
    
creating an additional variable indicating whether the data
was missing for that observation (1) or not (0).
creating an additional variable indicating whether the data was missing for that observation ( 1 ) or not ( 0 ) .
def add_var_denote_NA(data,NA_col=[]):
    data_copy = data.copy(deep=True)
    for i in NA_col:
        if data_copy[i].isnull().sum()>0:
            data_copy[i+'_is_NA'] = np.where(data_copy[i].isnull(),1,0)
        else:
            warn("Column %s has no missing cases" % i)
    return data_copy
def add_var_denote_NA ( data , NA_col = [ ] ) : data_copy = data . copy ( deep = True ) for i in NA_col : if data_copy [ i ] . isnull ( ) . sum ( ) > 0 : data_copy [ i + '_is_NA' ] = np . where ( data_copy [ i ] . isnull ( ) , 1 , 0 ) else : warn ( "Column %s has no missing cases" % i ) return data_copy
creating an additional variable indicating whether the data
was missing for that observation (1) or not (0).
creating an additional variable indicating whether the data was missing for that observation ( 1 ) or not ( 0 ) .
"""
    creating an additional variable indicating whether the data 
    was missing for that observation (1) or not (0).
    """
data
NA_col