def pipe(original):


    class PipeInto(object):
        data = {'function': original}

def __init__(self, *args, **kwargs):
    self.data['args'] = args
self.data['kwargs'] = kwargs

def __rrshift__(self, other):
    return self.data['function'](other, *self.data['args'], **self.data[
        'kwargs'])
return PipeInto

@pipe
def select(df, *args):
    cols = [x for x in args]
return df[cols]

@pipe
def rename(df, **kwargs):
    for name, value in list(kwargs.items()):
        df = df.rename(columns={('%s' % name): '%s' % value})
return df
"Piping" output from one function to another using Python infix syntax