Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jordicorbilla/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
https://github.com/jordicorbilla/tablepy-lib
formatter jupyter-notebook markdown python table
Last synced: about 1 month ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/jordicorbilla/tablepy-lib
- Owner: JordiCorbilla
- License: mit
- Created: 2023-05-24T20:02:14.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-06-03T16:24:29.000Z (over 1 year ago)
- Last Synced: 2024-12-15T04:38:55.824Z (about 1 month ago)
- Topics: formatter, jupyter-notebook, markdown, python, table
- Language: Python
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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 markdowndata = {
"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_insertdata = {
"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);
```