mirror of
https://github.com/KevinMidboe/tableprint.git
synced 2025-10-29 18:00:16 +00:00
Updates README.md
This commit is contained in:
20
README.md
20
README.md
@@ -28,23 +28,35 @@ pip install tableprint
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
The `tableprint.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:
|
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
|
```python
|
||||||
import tableprint
|
import tableprint as tp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
data = np.random.randn(10, 3)
|
data = np.random.randn(10, 3)
|
||||||
headers = ['Column A', 'Column B', 'Column C']
|
headers = ['Column A', 'Column B', 'Column C']
|
||||||
|
|
||||||
tableprint.table(data, headers)
|
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 `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
|
## Documentation
|
||||||
Hosted at Read The Docs: [tableprint.readthedocs.org](http://tableprint.readthedocs.org)
|
Hosted at Read The Docs: [tableprint.readthedocs.org](http://tableprint.readthedocs.org)
|
||||||
|
|
||||||
## Dependencies
|
## Dependencies
|
||||||
- Python 2.7 or 3.3+
|
- Python 3.6, 3.5, 3.4, or 2.7
|
||||||
- `numpy`
|
- `numpy`
|
||||||
- `six`
|
- `six`
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user