Skip to content

Provide a template-engine based way of rendering pandas data objects #3190

Closed
@ghost

Description

to_string(), to_html(), to_latex(), formatters, float_format, etc.

related #459

Template engines [jinja2, mako] are the accepted way of converting data into documents,
and the web dev community has provided great libraries to do it.
We should piggyback.

This would be good:

  • Give users the power to scratch their own itch, avoiding the need for pandas devs
    do it, or ignoring "fringe" use cases.
  • Provides users with a readable baseline , which is easy to modify and adapt to their needs.
  • Having a standard way to do it (by customizing a template), users can more easily
    have their output blend into python, and they can contribute / manage / source-control
    document templates in a clean, self-contained way.
  • Escape the "%d" not "{:d}" silliness and format strings in general, which is a relic of
    olden 2.5 support days. No more parameter hell necessary to make the existing methods
    more expressive. I never ever want to format html tables using function arguments.
  • Use a better way to express formatting logic via a DSL, rather then piecing together
    python strings.
  • Unify the handling of textual representations, not different code, only different template files.
  • Can refactor this out of core (but not really, see below)
  • Can provide features such as conditional formatting, styling.

However,

  • Can't really remove existing methods.
  • Adding a template engine dependency to pandas is clearly feature-creep (IMO).

So,

  • Make it a standalone project out of core (or optional dependency?)
  • Translate the existing styles into template form.
  • Provide hooks in pandas to allow users to optionally install the
    library and use it for rendeing
  • Let users know it's available for their use.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementIO HTMLread_html, to_html, Styler.apply, Styler.applymapIdeasLong-Term Enhancement DiscussionsOutput-Formatting__repr__ of pandas objects, to_string

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions