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

import warnings

warnings.simplefilter('ignore')
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)

train_transaction = pd.read_csv('../input/ieee-fraud-detection/train_transaction.csv')
train_identity = pd.read_csv('../input/ieee-fraud-detection/train_identity.csv')
test_transaction = pd.read_csv('../input/ieee-fraud-detection/test_transaction.csv')
test_identity = pd.read_csv('../input/ieee-fraud-detection/test_identity.csv')
sample_submission = pd.read_csv('../input/ieee-fraud-detection/sample_submission.csv')

train_df = train_transaction.merge(train_identity, how='left', on='TransactionID')
test_df = test_transaction.merge(test_identity, how='left', on='TransactionID')

train_df = train_df.rename(columns=lambda x: ''.join(x.split('_')))
test_df = test_df.rename(columns=lambda x: '_'.join(x.split('-')))
test_df = test_df.rename(columns=lambda x: ''.join(x.split('_')))

for i in train_df.columns:
    if train_df[i].dtypes == 'int64' or train_df[i].dtypes == 'float64':
        train_df[i].fillna(train_df[i].mean(), inplace=True)

for i in train_df.columns:
    if train_df[i].dtypes == 'object':
        train_df[i].fillna(train_df[i].mode()[0], inplace=True)

train_df.isnull().sum()