Skip to main content

exports pandas DataFrames/Series as HTML (formatted string that looks like a table!)

pip install a-pandas-ex-df2htmlstring

Tested against Windows 10 / Python 3.10 / Anaconda

How to use it

from a_pandas_ex_df2htmlstring import pd_add_df2htmlstring

pd_add_df2htmlstring()
import pandas as pd
from random import choice

csvtests = [
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_parameters.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_pm25_long.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_stations.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/baseball.csv",
    "https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv",
]
csvfile = choice(csvtests)
df = pd.read_csv(csvfile)
outfile = "e:\\outputhtml.html"
df.ds_2htmlstring(
    outputfile=outfile, fontsize=12, fontcolor="black", repeat_columns_n_rows=70
)
os.startfile(outfile)
df.Name.ds_2htmlstring(
    outputfile=outfile, fontsize=12, fontcolor="black", repeat_columns_n_rows=70
)


Converts a pandas DataFrame to an HTML string with customizable font size, font color, and repeated column headers.

Args:
	df (pandas.DataFrame / pandas.Series): The DataFrame to be converted to an HTML string. (automatically passed)
	outputfile (str, optional): The name of the output file to save the HTML string to. Defaults to None (won't be saved on HDD).
	fontsize (int, optional): The font size of the HTML string. Defaults to 12.
	fontcolor (str, optional): The font color of the HTML string. Defaults to "black".
	repeat_columns_n_rows (int, optional): The number of rows after which to repeat the column headers. Defaults to 70.

Returns:
	str: The HTML string representation of the DataFrame.

Metadata

Release files for a-pandas-ex-df2htmlstring 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for a-pandas-ex-df2htmlstring 0.10
File Size Uploaded Provenance Actions
a_pandas_ex_df2htmlstring-0.10.tar.gz 5.2 kB Without provenance Details for a_pandas_ex_df2htmlstring-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for a-pandas-ex-df2htmlstring 0.10
File Interpreter ABI Platform Actions
a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl Python 3 none any Details for a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl

Total release size: 13.2 kB

Release files / a_pandas_ex_df2htmlstring-0.10.tar.gz

Download URL a_pandas_ex_df2htmlstring-0.10.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6981732b79dfabca66c5a2a18897825f42b9ee6737382f805c0938c37256a43e
BLAKE2b-256 checksum
How to use checksums
4c0e874e841f8a29ee30f66927f5ffc111acdbbedd04d472e786cfa6d0a9a6af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl

Download URL a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2f467d641f2b8bd6b1ba0f65a937bc06253a251743f0deb533be0a4ce19e3593
BLAKE2b-256 checksum
How to use checksums
1f6a9a7f7e3bb64ac15021a254bc732b0237999c8a44bb5c222e6e9116915a04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Security for a-pandas-ex-df2htmlstring 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page