def create_difference_feature(data, feature1, feature2, group_by=None):
    """
    Perform difference between two features as new feature
    :param data:
    :param feature1:
    :param feature2:
    :return:
    """
    if group_by is not None:
        tmp_data = data.groupby(data[group_by])
        difference_feature = tmp_data[feature1] - tmp_data[feature2]
    else:
        difference_feature = data[feature1] - data[feature2]

    return difference_feature