tablepy-lib


Nametablepy-lib JSON
Version 0.8.0 PyPI version JSON
download
home_page
SummaryThis is a versatile and user-friendly Python table library that can quickly render any Dictionary{key, []} or DataFrame into a visually appealing markdown or sql insert
upload_time2023-06-03 14:57:45
maintainer
docs_urlNone
authorJordi Corbilla
requires_python>=3.9,<4.0
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # tablepy Lib

This is a versatile and user-friendly Python table library that can quickly render any Dictionary{key, []} or DataFrame into a visually appealing markdown or sql insert

## Download Stats

https://pypistats.org/packages/tablepy-lib

## Notebook for testing

https://github.com/JordiCorbilla/tablepy-lib/blob/main/Test%20Package.ipynb

## Usage: Output as Markdown/console

```python
from tablepy_lib import markdown

data = {
    "Name": ["John", "Emily", "Tom", "JC"],
    "Age": [-28, 3002.6, 25, 2],
    "Country": ["USA", "Canada", "UK", "DE"],
    "Data": ["USA", "Canada", "UK", "3434243"]
}

table = markdown(data)
print(table)    
```

Sample output:

```
| Name    | Age      | Country   | Data      | 
| ------- | -------- | --------- | --------- | 
| John    | -28.0    | USA       | USA       | 
| Emily   | 3002.6   | Canada    | Canada    | 
| Tom     | 25.0     | UK        | UK        | 
| JC      | 2.0      | DE        | 3434243   | 
```

| Name    | Age      | Country   | Data      | 
| ------- | -------- | --------- | --------- | 
| John    | -28.0    | USA       | USA       | 
| Emily   | 3002.6   | Canada    | Canada    | 
| Tom     | 25.0     | UK        | UK        | 
| JC      | 2.0      | DE        | 3434243   | 

## Usage: Output as SQL Insert

```python
from tablepy_lib import sql_insert

data = {
    "Name": ["John", "Emily", "Tom", "JC"],
    "Age": [-28, 3002.6, 25, 2],
    "Country": ["USA", "Canada", "UK", "DE"],
    "Data": ["USA", "Canada", "UK", "3434243"]
}

data_frame = pd.DataFrame(data)
table = sql_insert(data_frame, 'dd')
print(table)

```

Sample output:

```sql
INSERT INTO dd (Name, Age, Country, Data) VALUES ('John', -28.0, 'USA', 'USA');
INSERT INTO dd (Name, Age, Country, Data) VALUES ('Emily', 3002.6, 'Canada', 'Canada');
INSERT INTO dd (Name, Age, Country, Data) VALUES ('Tom', 25.0, 'UK', 'UK');
INSERT INTO dd (Name, Age, Country, Data) VALUES ('JC', 2.0, 'DE', 3434243);
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "tablepy-lib",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jordi Corbilla",
    "author_email": "jordi.coll.corbilla@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ce/2b/d5ad72a520ae4756b5e08b1e22a607c2dbd3c3ca73824a6814871d82027b/tablepy_lib-0.8.0.tar.gz",
    "platform": null,
    "description": "# tablepy Lib\n\nThis is a versatile and user-friendly Python table library that can quickly render any Dictionary{key, []} or DataFrame into a visually appealing markdown or sql insert\n\n## Download Stats\n\nhttps://pypistats.org/packages/tablepy-lib\n\n## Notebook for testing\n\nhttps://github.com/JordiCorbilla/tablepy-lib/blob/main/Test%20Package.ipynb\n\n## Usage: Output as Markdown/console\n\n```python\nfrom tablepy_lib import markdown\n\ndata = {\n    \"Name\": [\"John\", \"Emily\", \"Tom\", \"JC\"],\n    \"Age\": [-28, 3002.6, 25, 2],\n    \"Country\": [\"USA\", \"Canada\", \"UK\", \"DE\"],\n    \"Data\": [\"USA\", \"Canada\", \"UK\", \"3434243\"]\n}\n\ntable = markdown(data)\nprint(table)    \n```\n\nSample output:\n\n```\n| Name    | Age      | Country   | Data      | \n| ------- | -------- | --------- | --------- | \n| John    | -28.0    | USA       | USA       | \n| Emily   | 3002.6   | Canada    | Canada    | \n| Tom     | 25.0     | UK        | UK        | \n| JC      | 2.0      | DE        | 3434243   | \n```\n\n| Name    | Age      | Country   | Data      | \n| ------- | -------- | --------- | --------- | \n| John    | -28.0    | USA       | USA       | \n| Emily   | 3002.6   | Canada    | Canada    | \n| Tom     | 25.0     | UK        | UK        | \n| JC      | 2.0      | DE        | 3434243   | \n\n## Usage: Output as SQL Insert\n\n```python\nfrom tablepy_lib import sql_insert\n\ndata = {\n    \"Name\": [\"John\", \"Emily\", \"Tom\", \"JC\"],\n    \"Age\": [-28, 3002.6, 25, 2],\n    \"Country\": [\"USA\", \"Canada\", \"UK\", \"DE\"],\n    \"Data\": [\"USA\", \"Canada\", \"UK\", \"3434243\"]\n}\n\ndata_frame = pd.DataFrame(data)\ntable = sql_insert(data_frame, 'dd')\nprint(table)\n\n```\n\nSample output:\n\n```sql\nINSERT INTO dd (Name, Age, Country, Data) VALUES ('John', -28.0, 'USA', 'USA');\nINSERT INTO dd (Name, Age, Country, Data) VALUES ('Emily', 3002.6, 'Canada', 'Canada');\nINSERT INTO dd (Name, Age, Country, Data) VALUES ('Tom', 25.0, 'UK', 'UK');\nINSERT INTO dd (Name, Age, Country, Data) VALUES ('JC', 2.0, 'DE', 3434243);\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "This is a versatile and user-friendly Python table library that can quickly render any Dictionary{key, []} or DataFrame into a visually appealing markdown or sql insert",
    "version": "0.8.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e1cb625e7ea54ce9d452116a844391cb592319d9bc9fed79012f3153933458e",
                "md5": "0936f41e3425587dc0f2b37f8e31dbfc",
                "sha256": "1b304bfa6f681943022e07af3cfaa0ece6e07daea49432f0da82b677073187a6"
            },
            "downloads": -1,
            "filename": "tablepy_lib-0.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0936f41e3425587dc0f2b37f8e31dbfc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 4009,
            "upload_time": "2023-06-03T14:57:43",
            "upload_time_iso_8601": "2023-06-03T14:57:43.894191Z",
            "url": "https://files.pythonhosted.org/packages/0e/1c/b625e7ea54ce9d452116a844391cb592319d9bc9fed79012f3153933458e/tablepy_lib-0.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ce2bd5ad72a520ae4756b5e08b1e22a607c2dbd3c3ca73824a6814871d82027b",
                "md5": "a494a962ea3761cfe57f553832d3cc79",
                "sha256": "db1ac0353b6ab7fdd9d6f997f2e8dbbd4193bee95f66321f0ebba7697e9df474"
            },
            "downloads": -1,
            "filename": "tablepy_lib-0.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a494a962ea3761cfe57f553832d3cc79",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 3335,
            "upload_time": "2023-06-03T14:57:45",
            "upload_time_iso_8601": "2023-06-03T14:57:45.025249Z",
            "url": "https://files.pythonhosted.org/packages/ce/2b/d5ad72a520ae4756b5e08b1e22a607c2dbd3c3ca73824a6814871d82027b/tablepy_lib-0.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-03 14:57:45",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "tablepy-lib"
}
        
Elapsed time: 0.08278s