a-pandas-ex-df2htmlstring


Namea-pandas-ex-df2htmlstring JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/a_pandas_ex_df2htmlstring
Summaryexports pandas DataFrames/Series as HTML (formatted string that looks like a table!)
upload_time2023-04-28 00:08:08
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords pandas html convert
VCS
bugtrack_url
requirements a_pandas_ex_df_to_string pandas touchtouch
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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


![](https://github.com/hansalemaos/screenshots/raw/main/pandasstringhtml.png)



### How to use it

```python
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.

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/a_pandas_ex_df2htmlstring",
    "name": "a-pandas-ex-df2htmlstring",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "pandas,html,convert",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4c/0e/874e841f8a29ee30f66927f5ffc111acdbbedd04d472e786cfa6d0a9a6af/a_pandas_ex_df2htmlstring-0.10.tar.gz",
    "platform": null,
    "description": "# exports pandas DataFrames/Series as HTML (formatted string that looks like a table!)\r\n\r\n### pip install a-pandas-ex-df2htmlstring\r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda\r\n\r\n\r\n![](https://github.com/hansalemaos/screenshots/raw/main/pandasstringhtml.png)\r\n\r\n\r\n\r\n### How to use it\r\n\r\n```python\r\nfrom a_pandas_ex_df2htmlstring import pd_add_df2htmlstring\r\n\r\npd_add_df2htmlstring()\r\nimport pandas as pd\r\nfrom random import choice\r\n\r\ncsvtests = [\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_long.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_no2_long.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_parameters.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_pm25_long.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/air_quality_stations.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/baseball.csv\",\r\n    \"https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv\",\r\n]\r\ncsvfile = choice(csvtests)\r\ndf = pd.read_csv(csvfile)\r\noutfile = \"e:\\\\outputhtml.html\"\r\ndf.ds_2htmlstring(\r\n    outputfile=outfile, fontsize=12, fontcolor=\"black\", repeat_columns_n_rows=70\r\n)\r\nos.startfile(outfile)\r\ndf.Name.ds_2htmlstring(\r\n    outputfile=outfile, fontsize=12, fontcolor=\"black\", repeat_columns_n_rows=70\r\n)\r\n\r\n\r\nConverts a pandas DataFrame to an HTML string with customizable font size, font color, and repeated column headers.\r\n\r\nArgs:\r\n\tdf (pandas.DataFrame / pandas.Series): The DataFrame to be converted to an HTML string. (automatically passed)\r\n\toutputfile (str, optional): The name of the output file to save the HTML string to. Defaults to None (won't be saved on HDD).\r\n\tfontsize (int, optional): The font size of the HTML string. Defaults to 12.\r\n\tfontcolor (str, optional): The font color of the HTML string. Defaults to \"black\".\r\n\trepeat_columns_n_rows (int, optional): The number of rows after which to repeat the column headers. Defaults to 70.\r\n\r\nReturns:\r\n\tstr: The HTML string representation of the DataFrame.\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "exports pandas DataFrames/Series as HTML (formatted string that looks like a table!)",
    "version": "0.10",
    "split_keywords": [
        "pandas",
        "html",
        "convert"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1f6a9a7f7e3bb64ac15021a254bc732b0237999c8a44bb5c222e6e9116915a04",
                "md5": "f30ae32833ca0b5b881a3fc35231a9d4",
                "sha256": "2f467d641f2b8bd6b1ba0f65a937bc06253a251743f0deb533be0a4ce19e3593"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f30ae32833ca0b5b881a3fc35231a9d4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 8020,
            "upload_time": "2023-04-28T00:08:06",
            "upload_time_iso_8601": "2023-04-28T00:08:06.489931Z",
            "url": "https://files.pythonhosted.org/packages/1f/6a/9a7f7e3bb64ac15021a254bc732b0237999c8a44bb5c222e6e9116915a04/a_pandas_ex_df2htmlstring-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4c0e874e841f8a29ee30f66927f5ffc111acdbbedd04d472e786cfa6d0a9a6af",
                "md5": "6a6faf4b4a1bd4ad55ad1513b59b9b41",
                "sha256": "6981732b79dfabca66c5a2a18897825f42b9ee6737382f805c0938c37256a43e"
            },
            "downloads": -1,
            "filename": "a_pandas_ex_df2htmlstring-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "6a6faf4b4a1bd4ad55ad1513b59b9b41",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5209,
            "upload_time": "2023-04-28T00:08:08",
            "upload_time_iso_8601": "2023-04-28T00:08:08.267786Z",
            "url": "https://files.pythonhosted.org/packages/4c/0e/874e841f8a29ee30f66927f5ffc111acdbbedd04d472e786cfa6d0a9a6af/a_pandas_ex_df2htmlstring-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-28 00:08:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "hansalemaos",
    "github_project": "a_pandas_ex_df2htmlstring",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "a_pandas_ex_df_to_string",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "touchtouch",
            "specs": []
        }
    ],
    "lcname": "a-pandas-ex-df2htmlstring"
}
        
Elapsed time: 0.08121s