lisa.datautils.DataAccessor#

class lisa.datautils.DataAccessor(data)[source]#

Bases: object

Proxy class that allows extending the pandas.DataFrame API.

Example:

# Define and register a dataframe accessor
@DataFrameAccessor.register_accessor
def df_foobar(df, baz):
    ...

df = pandas.DataFrame()
# Use the accessor with the "lisa" proxy
df.lisa.foobar(baz=1)

Methods

__getattr__()

register_accessor()

Decorator to register an accessor function.

Methods#

DataAccessor.__getattr__(attr)[source]#
classmethod DataAccessor.register_accessor(f)[source]#

Decorator to register an accessor function.

The accessor name will be the name of the function, without the series_ or df_ prefix.