jmquintana79
1/12/2018 - 3:56 AM

dfply data

dfply library data processing. Homepage: https://github.com/kieferk/dfply

  • dfply functions: are a regular function which are possible to be used inside of any pipe.
  • dfply custom pipes: are a function which are possible to be used as a pipe.
## drop nan values
@dfpipe
def dropnan(df, *args, **kwargs):
    return df.dropna()
## GENERAL FUNCTION to be applied on df and store in a new column
@make_symbolic
def f(x,y):
    from numpy import sqrt
    return sqrt(x**2+y**2)
data >> mutate(newcol=f(X.x,X.y))