human
I am working on the file "Sobrecarga-de-operadores-em-Python.ipynb".
The first task is:
Princípio da Menor Surpresa
<img src="operacao.png">
Finalmente
Can you write Python code for it?
assistant
#Here is the Python code you requested.

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):
    return df[list(cols)]

@pipe
def rename(df, **kwargs):
    for name, value in kwargs.items():
        df = df.rename(columns={'%s' % name: '%s' % value})
    return df

df >> select('two', 'one')

df

df >> select('one') >> rename(one='first') 

16 << 1