def n_products(data_frame, n=10, view_type='head'):
    """ Finds the top or bottom n products in orders/sales.

    :param data_frame: DataFrame containing order_products data.
    :param n: number of products
    :param view_type: Defines the type either head or tail.
    :return: DataFrame of top or bottom n products
    """
    grouped = data_frame.groupby('product_id')
    count = grouped.size().reset_index(name='order_id_count')
    sort_count = count.sort_values(by='order_id_count', ascending=False)
    if view_type is 'head':
        return sort_count.head(n)
    elif view_type is 'tail':
        return sort_count.tail(n)
    else:
        print('view_type can either be head or tail.')