HHammond / PrettyPandas

A Pandas Styler class for making beautiful tables
http://prettypandas.readthedocs.org/
MIT License
415 stars 23 forks source link

Update API to use Pandas Accessor Extensions #50

Open HHammond opened 6 years ago

HHammond commented 6 years ago

After looking over https://pandas.pydata.org/pandas-docs/stable/extending.html I've extended the PrettyPandas API to use pandas accessors.

With this update you can now write code like this:

(
    df
    .summarize
    .average()
    .total(axis=1)
    .as_percent(subset=['a', 'Total'])
    .as_currency('EUR', subset=['b'])
)

This PR also has a few bug fixes and expanded support for pandas Series objects.

Zsailer commented 4 years ago

@HHammond great stuff here.

I thought I'd point you to pandas-flavor. It backports the Pandas extensions API to older versions of Pandas. It also includes method registration, enabling you to register methods directly to DataFrame and Series APIs.