# tableprint
Pretty console printing :clipboard: of tabular data in python :snake:
![build](https://github.com/nirum/tableprint/workflows/build/badge.svg)
[![codecov](https://codecov.io/gh/nirum/tableprint/branch/master/graph/badge.svg)](https://codecov.io/gh/nirum/tableprint)
[![docs](https://readthedocs.org/projects/tableprint/badge/?version=latest)](https://tableprint.readthedocs.io/?badge=latest)
[![pypi](https://img.shields.io/pypi/v/tableprint.svg)](https://pypi.python.org/pypi/tableprint)
## �對� About
`tableprint` lets you easily print formatted tables of data.
Unlike other modules, you can print single rows of data at a time (useful for printing ongoing computation results).
![Example output](https://raw.githubusercontent.com/nirum/tableprint/master/example.png)
## ��� Table of Contents
- [About](#��%EF%B8%8E-about)
- [Installation](#-installation)
- [Usage](#-usage)
- [Documentation](#-documentation)
- [Dependencies](#-dependencies)
- [Contributors](#heart-contributors)
- [Changelog](#-changelog)
- [License](#-license)
## ��� Installation
```bash
pip install tableprint
```
## ��� Usage
The `table` function takes in a matrix of data, a list of headers, a width (defaults to 11) and a style (defaults to 'round'). To print a dataset consisting of 10 rows of 3 different columns with the default width and style:
```python
import tableprint as tp
import numpy as np
data = np.random.randn(10, 3)
headers = ['Column A', 'Column B', 'Column C']
tp.table(data, headers)
```
The `header` and `row` functions allow you to print just the header or just a row of data, respectively, which is useful for continuously updating a table during a long-running computation. Also, the `banner` function is useful for just printing out a nicely formatted message to the user.
The `TableContext` context manager is useful for dynamically updating tables (e.g. during a long running computation):
```python
import tableprint as tp
import numpy as np
import time
with tp.TableContext("ABC") as t:
for _ in range(10):
time.sleep(0.1)
t(np.random.randn(3,))
```
## ��� Documentation
Hosted at Read The Docs: [tableprint.readthedocs.org](http://tableprint.readthedocs.org)
## ��� Dependencies
- Python 3.6+
- [future](https://pypi.org/project/future/)
- [six](https://pypi.org/project/six/)
## :heart: Contributors
Thanks to: [@nowox](https://github.com/nowox), [@nicktimko](https://github.com/nicktimko), [@mubaris](https://github.com/mubaris), and [@sumanthratna](https://github.com/sumanthratna) for contributions.
## ��� Changelog
| Version | Release Date | Description |
| ------: | :----------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0.9.1 | Aug 9 2020 | Drops python2 support. |
| 0.9.0 | May 16 2020 | Adds support for automatically determining the table's width. |
| 0.8.0 | Oct 24 2017 | Improves support for international languages, removes numpy dependency |
| 0.7.0 | May 26 2017 | Adds a TableContext context manager for easy creation of dynamic tables (tables that update periodically). Adds the ability to pass a list or tuple of widths to specify different widths for different columns |
| 0.6.9 | May 25 2017 | Splitting the tableprint.py module into a pacakge with multiple files |
| 0.6.7 | May 25 2017 | Fixes some bugs with ANSI escape sequences |
| 0.5.0 | Sept 29 2016 | Better handling of ANSI escape sequences in table rows |
| 0.4.0 | May 3 2016 | Adds a 'block' style |
| 0.3.2 | May 3 2016 | Adds a test suite |
| 0.3.0 | May 3 2016 | Adds custom styles for tables, specified by a key ('fancy_grid', 'grid', etc.) |
| 0.2.0 | May 2 2016 | Adds better python2 (unicode/bytes) compatibility |
| 0.1.5 | Oct 1 2015 | Renamed hrtime to humantime, added docs |
| 0.1.4 | Sept 28 2015 | Added human readable string converter (hrtime) |
| 0.1.0 | Feb 24 2015 | Initial release |
## ��� License
MIT. See [`LICENSE.md`](./LICENSE.md)
没有合适的资源?快使用搜索试试~ 我知道了~
tableprint:Python中表格数据的漂亮控制台打印
共20个文件
py:10个
txt:2个
md:2个
需积分: 45 1 下载量 91 浏览量
2021-02-06
13:36:03
上传
评论 1
收藏 161KB ZIP 举报
温馨提示
表格打印 漂亮的控制台打印 :clipboard: python中的表格数据集 :snake: :information:︎关于 tableprint使您可以轻松打印格式化的数据表。 与其他模块不同,您可以一次打印单行数据(用于打印正在进行的计算结果)。 :magnifying_glass_tilted_right: 目录 :laptop: 安装 pip install tableprint :person_running: 用法 table函数采用数据矩阵,标题列表,宽度(默认为11)和样式(默认为'round')。 要以默认宽度和样式打印由10行3个不同列组成的数据集,请执行以下操作: import tableprint as tp import numpy as np data = np . random . randn ( 10 ,
资源详情
资源评论
资源推荐
收起资源包目录
tableprint-master.zip (20个子文件)
tableprint-master
setup.py 2KB
.gitignore 95B
requirements.txt 21B
tableprint
style.py 2KB
__init__.py 153B
printer.py 9KB
utils.py 3KB
metadata.py 311B
License.md 1KB
.github
workflows
build.yml 1KB
publish.yml 865B
README.md 6KB
tests
test_functions.py 862B
test_io.py 2KB
test_utils.py 2KB
example.png 157KB
docs
Makefile 7KB
index.rst 2KB
conf.py 10KB
requirements-dev.txt 43B
共 20 条
- 1
人间发财树
- 粉丝: 23
- 资源: 4560
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0