pyjanitor-devs / pandas_flavor

The easy way to write your own flavor of Pandas
https://zsailer.github.io/software/pandas-flavor/
MIT License
301 stars 17 forks source link

Documentation: Making a "flavor" python package #11

Closed Zsailer closed 5 years ago

Zsailer commented 5 years ago

Reflecting back on this #3, it's not clear from the README how to make a pandas "flavor" that's importable.

The README shows how to register functions to DataFrames, but I think it needs documentation on how to write these functions in a module/package that you can import.

Something like:

  1. Add "flavoring" functions in a module or package file my_flavor.py

    import pandas_flavor as pf
    
    @pf.register_series_method
    @pf.register_dataframe_method
    def cool_func(df, arg):
        print(arg)
        return df 
  2. Import Pandas and that "flavor" module/package in a Python session.

    import pandas as pd
    import my_flavor
    
    df = pd.DataFrame(...).cool_func()