def _check_features(schema1, schema2):
    """
    Get list of features to check based on table schemas

    Parameters
    ----------
    schema1: table1 schema
    schema2: table2 schema

    Returns
    -------
    schema:
        merged and modified schema
    check_features:
        a dictionary of (data type, feature list) to check
    """

    # select useful columns in schema
    schema1 = schema1[schema1['column'] != 'column not in current table'][['column', 'type', 'include']].rename(
        columns={'column': 'column_1', 'type': 'type_1', 'include': 'include_1'})
    schema2 = schema2[schema2['column'] != 'column not in current table'][['column', 'type', 'include']].rename(
        columns={'column': 'column_2', 'type': 'type_2', 'include': 'include_2'})

    # merge two schemas
    schema = schema1.merge(schema2, left_on='column_1', right_on='column_2', how='outer')

    # start to record the errors
    schema['error'] = ''

    schema.loc[schema['type_1'] != schema['type_2'], 'error'] = "inconsistent data types"
    schema.loc[schema['include_1'] == 0, 'error'] = "exclude"
    schema.loc[schema['include_1'] != schema['include_2'], 'error'] = "inconsistent include"
    schema.loc[schema['column_1'].isnull(), 'error'] = "column not in table1"
    schema.loc[schema['column_2'].isnull(), 'error'] = "column not in table2"

    # classify the features to compare
    schema_correct_include = schema[(schema['include_1'] == 1) & (schema['error'] == '')].reset_index(drop=True)

    check_features = {}
    for dtype in ['key', 'numeric', 'str', 'date']:
        check_features[dtype] = schema_correct_include[schema_correct_include['type_1'] == dtype]['column_1'].values

    return schema, check_features