GithubHelp home page GithubHelp logo

hhammond / prettypandas Goto Github PK

View Code? Open in Web Editor NEW
410.0 12.0 23.0 3.63 MB

A Pandas Styler class for making beautiful tables

Home Page: http://prettypandas.readthedocs.org/

License: MIT License

Python 100.00%
pandas-styler pandas pandas-dataframes pandas-dataframe reporting data-analysis python data-science

prettypandas's People

Contributors

eyaltrabelsi avatar hhammond avatar wadephillips avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prettypandas's Issues

Example should simply be copy/pastable

Hello,

https://github.com/HHammond/PrettyPandas/blob/master/Readme.md provides an example
but it should simply be copy/pastable

import pandas as pd
from pandas.compat import StringIO

dat = """A;B;C;D
10;58.0;0.07156;0.39343
2.51;64.0;1.21872;0.33958
5;56.0;1.38399;0.26289
2.51;47.0;0.45284;1.47185
5;46.0;1.19918;2.08354"""

df = pd.read_csv(StringIO(dat), sep=";")
df

from prettypandas import PrettyPandas

(PrettyPandas(df, precision=0)
 .as_percent(subset=['C', 'D'], precision=3)
 .as_money(subset='A')
 .average()
 .total()
)

Kind regards

TypeError: 'module' object is not callable

while running this code:
(
df4
.pipe(PrettyPandas)
.as_currency('USD', subset='Average Value')
.as_percent(subset='Yield')
.total()
.average()
)
I get the error:
TypeError: 'module' object is not callable.

I've successfully pip installed prettypandas
and ran import prettypandas
and import babel

All the documentation uses (PrettyPandas). Is this recognizable in Jupyter Notebooks?

Merge with Pandas?

This looks awesome. Have you tried submitting a PR to include in Pandas?

Add Testing

  • Test PrettyPandas
    • Test summary
    • Test arguments summary functions work correctly
    • Test number formatting functions

precision does not work for percentage format

The as_percent() format always display the value without decimals and the precision parameter has no effect at all. I checked the code and realized that:
1/ there are 2 as_percent() in formatters (only 'partial' object is used)
2/ the method as_percent() in class PrettyPandas does not use the precision parameter at all, so I changed the call to partial below the comment: '# TODO: Find good way to implement precision' as:

    # TODO: Find good way to implement precision
    precision = self.precision if precision is None else precision

    add_formatter = partial(self._format_cells,
                            as_percent,
                            subset=subset,
                            format='0.{}%'.format('0' * precision))

maybe there is a better implementation but at least the precision is taken into account now.

Cannot Export to Excel

Hey Henry,

I'm experiencing the following error:
AttributeError: 'PrettyPandas' object has no attribute 'to_excel'

I also tried to shove the results in a list, and spit the list back out as a dataframe, but that totally failed as well. Would you be able to implement the to_excel function any time soon?

Thank you so much!!!!

[Discussion] Should SVG Sparklines be supported in a future version?

Sparklines are a great way to represent data. Edward Tufte has a great post on the theory and applications.

I think sparklines definitely belong in reporting, the question is whether or not PrettyPandas should implement them itself.

What would a sparkline API even look like? Would this use another python library (that seems ideal)?

I'd love the look of http://metricsgraphicsjs.org/examples.htm#lines for the design.

Here's an example of a notebook with sparklines: https://github.com/iiSeymour/sparkline-nb/blob/master/sparkline-nb.ipynb. I like the way that the notebook has a single column with series data in it. The alternative would be to somehow slice on the index and hide the cells.

Import Errors with latest pandas

I believe the style imports have changed in pandas 0.18.
I get ImportError: No module named style

Should be:

from pandas.formats.style import Styler

API Feature Requests (v.0.0.3)

  • set_font
  • set_background - change cell background colours
  • set_alternating - apply alternating even-odd colours
  • set_hover - apply hover effects
  • set_cell_height - set minimum cell height
  • set_cell_width - set minimum cell width
  • describe - add stats similar to DataFrame.describe()

Allow non-heading for Series input.

Hey, so I ran the following code bit:

from prettypandas import PrettyPandas
PrettyPandas(data.notnull().all())

Since this is a Series, PrettyPandas produces a 0 header:

screen shot 2016-04-13 at 7 57 45 pm

Is it possible to remove this label?

Conda package

Hello,

It could be very useful to have a conda package for PrettyPandas.

$ conda install PrettyPandas
Fetching package metadata .........

PackageNotFoundError: Packages missing in current channels:

  - prettypandas

We have searched for the packages in the following channels:

  - https://repo.continuum.io/pkgs/free/osx-64
  - https://repo.continuum.io/pkgs/free/noarch
  - https://repo.continuum.io/pkgs/r/osx-64
  - https://repo.continuum.io/pkgs/r/noarch
  - https://repo.continuum.io/pkgs/pro/osx-64
  - https://repo.continuum.io/pkgs/pro/noarch

Otherwise, installing using pip works fine

$ pip install PrettyPandas
Collecting PrettyPandas
  Downloading prettypandas-0.0.3.tar.gz
Requirement already satisfied: babel in ./anaconda/lib/python3.6/site-packages (from PrettyPandas)
Requirement already satisfied: ipython in ./anaconda/lib/python3.6/site-packages (from PrettyPandas)
Requirement already satisfied: numpy in ./anaconda/lib/python3.6/site-packages (from PrettyPandas)
Requirement already satisfied: jinja2 in ./anaconda/lib/python3.6/site-packages (from PrettyPandas)
Requirement already satisfied: pandas>=0.17.1 in ./anaconda/lib/python3.6/site-packages (from PrettyPandas)
Requirement already satisfied: pytz>=0a in ./anaconda/lib/python3.6/site-packages (from babel->PrettyPandas)
Requirement already satisfied: MarkupSafe>=0.23 in ./anaconda/lib/python3.6/site-packages (from jinja2->PrettyPandas)
Requirement already satisfied: python-dateutil>=2 in ./anaconda/lib/python3.6/site-packages (from pandas>=0.17.1->PrettyPandas)
Requirement already satisfied: six>=1.5 in ./anaconda/lib/python3.6/site-packages (from python-dateutil>=2->pandas>=0.17.1->PrettyPandas)
Building wheels for collected packages: PrettyPandas
  Running setup.py bdist_wheel for PrettyPandas ... done
  Stored in directory: /Users/scls/Library/Caches/pip/wheels/ad/41/3c/a3d331a42437852dd0f4aa8156f2563072a388fdb92d27c3dc
Successfully built PrettyPandas
Installing collected packages: PrettyPandas
Successfully installed PrettyPandas-0.0.3

Kind regards

Pandas Style API doesn't support index titles.

Normally df.index.name = "XXX" add's a header to the index column of a dataframe, however when using the Style API this doesn't work.

It needs to be investigated whether this is a pandas issue or hidden in the API somewhere.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.