piper.verbs.right_join

piper.verbs.right_join(df: pandas.core.frame.DataFrame, *args, **kwargs)pandas.core.frame.DataFrame[source]

df (All/na) | df2 (All) df2 always returned

This is a wrapper function rather than using e.g. df.merge(how=’right’) For details of args, kwargs - see help(pd.DataFrame.merge)

Examples

order_data = {'OrderNo': [1001, 1002, 1003, 1004, 1005],
              'Status': ['A', 'C', 'A', 'A', 'P'],
              'Type_': ['SO', 'SA', 'SO', 'DA', 'DD']}
orders = pd.DataFrame(order_data)

status_data = {'Status': ['A', 'C', 'P'],
               'description': ['Active', 'Closed', 'Pending']}
statuses = pd.DataFrame(status_data)

order_types_data = {'Type_': ['SA', 'SO'],
                    'description': ['Sales Order', 'Standing Order'],
                    'description_2': ['Arbitrary desc', 'another one']}
types_ = pd.DataFrame(order_types_data)

%%piper
orders >> right_join(types_, suffixes=('_orders', '_types'))

    OrderNo   Status     Type_     description      description_2
       1002   C          SA        Sales Order      Arbitrary desc
       1001   A          SO        Standing Order   another one
       1003   A          SO        Standing Order   another one