image_output_1.png
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

app_train = pd.read_csv('../input/application_train.csv')

app_test = pd.read_csv('../input/application_test.csv')

def missing_values_table(df):
    """
    Function to calculate missing values by column
    Arguments:
        df: dataframe
    Output:
        miss_val_table_renamed_cols: dataframe with missing values
    """
    miss_value = df.isnull().sum()
    miss_value_pct = 100 * df.isnull().sum() / len(df)
    miss_val_table = pd.concat([miss_value, miss_value_pct], axis=1)
    miss_val_table_renamed_cols = miss_val_table.rename(columns={0: 'Missing Values', 1: '% of Total Values'})
    miss_val_table_renamed_cols = miss_val_table_renamed_cols[miss_val_table_renamed_cols.iloc[:, 1] != 0].sort_values('% of Total Values', ascending=False).round(1)
    return miss_val_table_renamed_cols

app_train.dtypes.value_counts()

app_train.select_dtypes('object').apply(pd.Series.nunique, axis=0)