Skip to main content

View/save any Pandas DataFrame/Series as HTML, works with MultiIndex as well

Project description

DataFrame / Series in your browser

#Based on pypi.org/project/any-iter-to-html-table/

from a_pandas_ex_html_view import pd_add_html_view

import pandas as pd

pd_add_html_view() #this adds to new methods to pandas

df = pd.read_csv("https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv")

df.ds_html_view() #for whole DataFrame

df.Name.ds_html_view() #for Series

For DataFrames with MultiIndex

If you create your MultiIndexed DataFrame using a-pandas-ex-plode-tool · PyPI

a_pandas_ex_html_view will format the DataFrame in the prettiest way possible :)

from a_pandas_ex_plode_tool import pd_add_explode_tools

pd_add_explode_tools()

data = {

    "glossary": {

        "title": "example glossary",

        "GlossDiv": {

            "title": "S",

            "GlossList": {

                "GlossEntry": {

                    "ID": "SGML",

                    "SortAs": "SGML",

                    "GlossTerm": "Standard Generalized Markup Language",

                    "Acronym": "SGML",

                    "Abbrev": "ISO 8879:1986",

                    "GlossDef": {

                        "para": "A meta-markup language, used to create markup languages such as DocBook.",

                        "GlossSeeAlso": ["GML", "XML"],

                    },

                    "GlossSee": "markup",

                }

            },

        },

    }

}

df = pd.Q_AnyNestedIterable_2df(data)

df.ds_html_view()   

#if you don't want to open it in browser, just save it to your HDD:

df.ds_html_view('f:\\testhtml.html') 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a_pandas_ex_html_view-0.1.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

a_pandas_ex_html_view-0.1-py3-none-any.whl (7.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page