Add loan-advisor-agent
Browse files- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/INSTALLER +1 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/METADATA +1305 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/RECORD +10 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/REQUESTED +0 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/WHEEL +5 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/entry_points.txt +2 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/licenses/LICENSE +20 -0
- loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/top_level.txt +1 -0
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
uv
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/METADATA
ADDED
|
@@ -0,0 +1,1305 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: tabulate
|
| 3 |
+
Version: 0.10.0
|
| 4 |
+
Summary: Pretty-print tabular data
|
| 5 |
+
Author-email: Sergey Astanin <s.astanin@gmail.com>
|
| 6 |
+
License-Expression: MIT
|
| 7 |
+
Project-URL: Homepage, https://github.com/astanin/python-tabulate
|
| 8 |
+
Classifier: Development Status :: 4 - Beta
|
| 9 |
+
Classifier: Operating System :: OS Independent
|
| 10 |
+
Classifier: Programming Language :: Python :: 3
|
| 11 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 12 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 13 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 14 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 15 |
+
Classifier: Programming Language :: Python :: 3.14
|
| 16 |
+
Classifier: Topic :: Software Development :: Libraries
|
| 17 |
+
Requires-Python: >=3.10
|
| 18 |
+
Description-Content-Type: text/markdown
|
| 19 |
+
License-File: LICENSE
|
| 20 |
+
Provides-Extra: widechars
|
| 21 |
+
Requires-Dist: wcwidth; extra == "widechars"
|
| 22 |
+
Dynamic: license-file
|
| 23 |
+
|
| 24 |
+
python-tabulate
|
| 25 |
+
===============
|
| 26 |
+
|
| 27 |
+
Pretty-print tabular data in Python, a library and a command-line
|
| 28 |
+
utility.
|
| 29 |
+
|
| 30 |
+
The main use cases of the library are:
|
| 31 |
+
|
| 32 |
+
- printing small tables without hassle: just one function call,
|
| 33 |
+
formatting is guided by the data itself
|
| 34 |
+
- authoring tabular data for lightweight plain-text markup: multiple
|
| 35 |
+
output formats suitable for further editing or transformation
|
| 36 |
+
- readable presentation of mixed textual and numeric data: smart
|
| 37 |
+
column alignment, configurable number formatting, alignment by a
|
| 38 |
+
decimal point
|
| 39 |
+
|
| 40 |
+
Installation
|
| 41 |
+
------------
|
| 42 |
+
|
| 43 |
+
To install the Python library and the command line utility, run:
|
| 44 |
+
|
| 45 |
+
```shell
|
| 46 |
+
pip install tabulate
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
The command line utility will be installed as `tabulate` to `bin` on
|
| 50 |
+
Linux (e.g. `/usr/bin`); or as `tabulate.exe` to `Scripts` in your
|
| 51 |
+
Python installation on Windows (e.g. `C:\Python39\Scripts\tabulate.exe`).
|
| 52 |
+
|
| 53 |
+
You may consider installing the library only for the current user:
|
| 54 |
+
|
| 55 |
+
```shell
|
| 56 |
+
pip install tabulate --user
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
In this case the command line utility will be installed to
|
| 60 |
+
`~/.local/bin/tabulate` on Linux and to
|
| 61 |
+
`%APPDATA%\Python\Scripts\tabulate.exe` on Windows.
|
| 62 |
+
|
| 63 |
+
To install just the library on Unix-like operating systems:
|
| 64 |
+
|
| 65 |
+
```shell
|
| 66 |
+
TABULATE_INSTALL=lib-only pip install tabulate
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
On Windows:
|
| 70 |
+
|
| 71 |
+
```shell
|
| 72 |
+
set TABULATE_INSTALL=lib-only
|
| 73 |
+
pip install tabulate
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
Build status
|
| 77 |
+
------------
|
| 78 |
+
|
| 79 |
+
[](https://github.com/astanin/python-tabulate/actions/workflows/tabulate.yml)
|
| 80 |
+
|
| 81 |
+
Library usage
|
| 82 |
+
-------------
|
| 83 |
+
|
| 84 |
+
The module provides just one function, `tabulate`, which takes a list of
|
| 85 |
+
lists or another tabular data type as the first argument, and outputs a
|
| 86 |
+
nicely formatted plain-text table:
|
| 87 |
+
|
| 88 |
+
```pycon
|
| 89 |
+
>>> from tabulate import tabulate
|
| 90 |
+
|
| 91 |
+
>>> table = [["Sun",696000,1989100000],["Earth",6371,5973.6],
|
| 92 |
+
... ["Moon",1737,73.5],["Mars",3390,641.85]]
|
| 93 |
+
>>> print(tabulate(table))
|
| 94 |
+
----- ------ -------------
|
| 95 |
+
Sun 696000 1.9891e+09
|
| 96 |
+
Earth 6371 5973.6
|
| 97 |
+
Moon 1737 73.5
|
| 98 |
+
Mars 3390 641.85
|
| 99 |
+
----- ------ -------------
|
| 100 |
+
|
| 101 |
+
```
|
| 102 |
+
|
| 103 |
+
The following tabular data types are supported:
|
| 104 |
+
|
| 105 |
+
- list of lists or another iterable of iterables
|
| 106 |
+
- list or another iterable of dicts (keys as columns)
|
| 107 |
+
- dict of iterables (keys as columns)
|
| 108 |
+
- list of dataclasses (field names as columns)
|
| 109 |
+
- two-dimensional NumPy array
|
| 110 |
+
- NumPy record arrays (names as columns)
|
| 111 |
+
- pandas.DataFrame
|
| 112 |
+
|
| 113 |
+
Tabulate is a Python3 library.
|
| 114 |
+
|
| 115 |
+
### Headers
|
| 116 |
+
|
| 117 |
+
The second optional argument named `headers` defines a list of column
|
| 118 |
+
headers to be used:
|
| 119 |
+
|
| 120 |
+
```pycon
|
| 121 |
+
>>> print(tabulate(table, headers=["Planet","R (km)", "mass (x 10^29 kg)"]))
|
| 122 |
+
Planet R (km) mass (x 10^29 kg)
|
| 123 |
+
-------- -------- -------------------
|
| 124 |
+
Sun 696000 1.9891e+09
|
| 125 |
+
Earth 6371 5973.6
|
| 126 |
+
Moon 1737 73.5
|
| 127 |
+
Mars 3390 641.85
|
| 128 |
+
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
If `headers="firstrow"`, then the first row of data is used:
|
| 132 |
+
|
| 133 |
+
```pycon
|
| 134 |
+
>>> print(tabulate([["Name","Age"],["Alice",24],["Bob",19]],
|
| 135 |
+
... headers="firstrow"))
|
| 136 |
+
Name Age
|
| 137 |
+
------ -----
|
| 138 |
+
Alice 24
|
| 139 |
+
Bob 19
|
| 140 |
+
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
If `headers="keys"`, then the keys of a dictionary/dataframe, or column
|
| 144 |
+
indices are used. It also works for NumPy record arrays and lists of
|
| 145 |
+
dictionaries or named tuples:
|
| 146 |
+
|
| 147 |
+
```pycon
|
| 148 |
+
>>> print(tabulate({"Name": ["Alice", "Bob"],
|
| 149 |
+
... "Age": [24, 19]}, headers="keys"))
|
| 150 |
+
Name Age
|
| 151 |
+
------ -----
|
| 152 |
+
Alice 24
|
| 153 |
+
Bob 19
|
| 154 |
+
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
When data is a list of dictionaries, a dictionary can be passed as `headers`
|
| 158 |
+
to replace the keys with other column labels:
|
| 159 |
+
|
| 160 |
+
```pycon
|
| 161 |
+
>>> print(tabulate([{1: "Alice", 2: 24}, {1: "Bob", 2: 19}],
|
| 162 |
+
... headers={1: "Name", 2: "Age"}))
|
| 163 |
+
Name Age
|
| 164 |
+
------ -----
|
| 165 |
+
Alice 24
|
| 166 |
+
Bob 19
|
| 167 |
+
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
### Row Indices
|
| 171 |
+
|
| 172 |
+
By default, only pandas.DataFrame tables have an additional column
|
| 173 |
+
called row index. To add a similar column to any other type of table,
|
| 174 |
+
pass `showindex="always"` or `showindex=True` argument to `tabulate()`.
|
| 175 |
+
To suppress row indices for all types of data, pass `showindex="never"`
|
| 176 |
+
or `showindex=False`. To add a custom row index column, pass
|
| 177 |
+
`showindex=rowIDs`, where `rowIDs` is some iterable:
|
| 178 |
+
|
| 179 |
+
```pycon
|
| 180 |
+
>>> print(tabulate([["F",24],["M",19]], showindex="always"))
|
| 181 |
+
- - --
|
| 182 |
+
0 F 24
|
| 183 |
+
1 M 19
|
| 184 |
+
- - --
|
| 185 |
+
|
| 186 |
+
```
|
| 187 |
+
|
| 188 |
+
### Table format
|
| 189 |
+
|
| 190 |
+
There is more than one way to format a table in plain text. The third
|
| 191 |
+
optional argument named `tablefmt` defines how the table is formatted.
|
| 192 |
+
|
| 193 |
+
Supported table formats are:
|
| 194 |
+
|
| 195 |
+
- "plain"
|
| 196 |
+
- "simple"
|
| 197 |
+
- "github"
|
| 198 |
+
- "grid"
|
| 199 |
+
- "simple\_grid"
|
| 200 |
+
- "rounded\_grid"
|
| 201 |
+
- "heavy\_grid"
|
| 202 |
+
- "mixed\_grid"
|
| 203 |
+
- "double\_grid"
|
| 204 |
+
- "fancy\_grid"
|
| 205 |
+
- "outline"
|
| 206 |
+
- "simple\_outline"
|
| 207 |
+
- "rounded\_outline"
|
| 208 |
+
- "heavy\_outline"
|
| 209 |
+
- "mixed\_outline"
|
| 210 |
+
- "double\_outline"
|
| 211 |
+
- "fancy\_outline"
|
| 212 |
+
- "pipe"
|
| 213 |
+
- "orgtbl"
|
| 214 |
+
- "asciidoc"
|
| 215 |
+
- "jira"
|
| 216 |
+
- "presto"
|
| 217 |
+
- "pretty"
|
| 218 |
+
- "psql"
|
| 219 |
+
- "rst"
|
| 220 |
+
- "mediawiki"
|
| 221 |
+
- "moinmoin"
|
| 222 |
+
- "youtrack"
|
| 223 |
+
- "html"
|
| 224 |
+
- "unsafehtml"
|
| 225 |
+
- "latex"
|
| 226 |
+
- "latex\_raw"
|
| 227 |
+
- "latex\_booktabs"
|
| 228 |
+
- "latex\_longtable"
|
| 229 |
+
- "textile"
|
| 230 |
+
- "tsv"
|
| 231 |
+
|
| 232 |
+
`plain` tables do not use any pseudo-graphics to draw lines:
|
| 233 |
+
|
| 234 |
+
```pycon
|
| 235 |
+
>>> table = [["spam",42],["eggs",451],["bacon",0]]
|
| 236 |
+
>>> headers = ["item", "qty"]
|
| 237 |
+
>>> print(tabulate(table, headers, tablefmt="plain"))
|
| 238 |
+
item qty
|
| 239 |
+
spam 42
|
| 240 |
+
eggs 451
|
| 241 |
+
bacon 0
|
| 242 |
+
|
| 243 |
+
```
|
| 244 |
+
|
| 245 |
+
`simple` is the default format (the default may change in future
|
| 246 |
+
versions). It corresponds to `simple_tables` in [Pandoc Markdown
|
| 247 |
+
extensions](http://johnmacfarlane.net/pandoc/README.html#tables):
|
| 248 |
+
|
| 249 |
+
```pycon
|
| 250 |
+
>>> print(tabulate(table, headers, tablefmt="simple"))
|
| 251 |
+
item qty
|
| 252 |
+
------ -----
|
| 253 |
+
spam 42
|
| 254 |
+
eggs 451
|
| 255 |
+
bacon 0
|
| 256 |
+
|
| 257 |
+
```
|
| 258 |
+
|
| 259 |
+
`github` follows the conventions of GitHub flavored Markdown. It
|
| 260 |
+
corresponds to the `pipe` format without alignment colons:
|
| 261 |
+
|
| 262 |
+
```pycon
|
| 263 |
+
>>> print(tabulate(table, headers, tablefmt="github"))
|
| 264 |
+
| item | qty |
|
| 265 |
+
|--------|-------|
|
| 266 |
+
| spam | 42 |
|
| 267 |
+
| eggs | 451 |
|
| 268 |
+
| bacon | 0 |
|
| 269 |
+
|
| 270 |
+
```
|
| 271 |
+
|
| 272 |
+
`grid` is like tables formatted by Emacs'
|
| 273 |
+
[table.el](http://table.sourceforge.net/) package. It corresponds to
|
| 274 |
+
`grid_tables` in Pandoc Markdown extensions:
|
| 275 |
+
|
| 276 |
+
```pycon
|
| 277 |
+
>>> print(tabulate(table, headers, tablefmt="grid"))
|
| 278 |
+
+--------+-------+
|
| 279 |
+
| item | qty |
|
| 280 |
+
+========+=======+
|
| 281 |
+
| spam | 42 |
|
| 282 |
+
+--------+-------+
|
| 283 |
+
| eggs | 451 |
|
| 284 |
+
+--------+-------+
|
| 285 |
+
| bacon | 0 |
|
| 286 |
+
+--------+-------+
|
| 287 |
+
|
| 288 |
+
```
|
| 289 |
+
|
| 290 |
+
`simple_grid` draws a grid using single-line box-drawing characters:
|
| 291 |
+
|
| 292 |
+
>>> print(tabulate(table, headers, tablefmt="simple_grid"))
|
| 293 |
+
┌────────┬───────┐
|
| 294 |
+
│ item │ qty │
|
| 295 |
+
├────────┼───────┤
|
| 296 |
+
│ spam │ 42 │
|
| 297 |
+
├────────┼───────┤
|
| 298 |
+
│ eggs │ 451 │
|
| 299 |
+
├────────┼───────┤
|
| 300 |
+
│ bacon │ 0 │
|
| 301 |
+
└────────┴───────┘
|
| 302 |
+
|
| 303 |
+
`rounded_grid` draws a grid using single-line box-drawing characters with rounded corners:
|
| 304 |
+
|
| 305 |
+
>>> print(tabulate(table, headers, tablefmt="rounded_grid"))
|
| 306 |
+
╭────────┬───────╮
|
| 307 |
+
│ item │ qty │
|
| 308 |
+
├────────┼───────┤
|
| 309 |
+
│ spam │ 42 │
|
| 310 |
+
├────────┼───────┤
|
| 311 |
+
│ eggs │ 451 │
|
| 312 |
+
├────────┼───────┤
|
| 313 |
+
│ bacon │ 0 │
|
| 314 |
+
╰────────┴───────╯
|
| 315 |
+
|
| 316 |
+
`heavy_grid` draws a grid using bold (thick) single-line box-drawing characters:
|
| 317 |
+
|
| 318 |
+
>>> print(tabulate(table, headers, tablefmt="heavy_grid"))
|
| 319 |
+
┏━━━━━━━━┳━━━━━━━┓
|
| 320 |
+
┃ item ┃ qty ┃
|
| 321 |
+
┣━━━━━━━━╋━━━━━━━┫
|
| 322 |
+
┃ spam ┃ 42 ┃
|
| 323 |
+
┣━━━━━━━━╋━━━━━━━┫
|
| 324 |
+
┃ eggs ┃ 451 ┃
|
| 325 |
+
┣━━━━━━━━╋━━━━━━━┫
|
| 326 |
+
┃ bacon ┃ 0 ┃
|
| 327 |
+
┗━━━━━━━━┻━━━━━━━┛
|
| 328 |
+
|
| 329 |
+
`mixed_grid` draws a grid using a mix of light (thin) and heavy (thick) lines box-drawing characters:
|
| 330 |
+
|
| 331 |
+
>>> print(tabulate(table, headers, tablefmt="mixed_grid"))
|
| 332 |
+
┍━━━━━━━━┯━━━━━━━┑
|
| 333 |
+
│ item │ qty │
|
| 334 |
+
┝━━━━━━━━┿━━━━━━━┥
|
| 335 |
+
│ spam │ 42 │
|
| 336 |
+
├────────┼───────┤
|
| 337 |
+
│ eggs │ 451 │
|
| 338 |
+
├────────┼───────┤
|
| 339 |
+
│ bacon │ 0 │
|
| 340 |
+
┕━━━━━━━━┷━━━━━━━┙
|
| 341 |
+
|
| 342 |
+
`double_grid` draws a grid using double-line box-drawing characters:
|
| 343 |
+
|
| 344 |
+
>>> print(tabulate(table, headers, tablefmt="double_grid"))
|
| 345 |
+
╔════════╦═══════╗
|
| 346 |
+
║ item ║ qty ║
|
| 347 |
+
╠════════╬═══════╣
|
| 348 |
+
║ spam ║ 42 ║
|
| 349 |
+
╠════════╬═══════╣
|
| 350 |
+
║ eggs ║ 451 ║
|
| 351 |
+
╠════════╬═══════╣
|
| 352 |
+
║ bacon ║ 0 ║
|
| 353 |
+
╚════════╩═══════╝
|
| 354 |
+
|
| 355 |
+
`fancy_grid` draws a grid using a mix of single and
|
| 356 |
+
double-line box-drawing characters:
|
| 357 |
+
|
| 358 |
+
```pycon
|
| 359 |
+
>>> print(tabulate(table, headers, tablefmt="fancy_grid"))
|
| 360 |
+
╒════════╤═══════╕
|
| 361 |
+
│ item │ qty │
|
| 362 |
+
╞════════╪═══════╡
|
| 363 |
+
│ spam │ 42 │
|
| 364 |
+
├────────┼───────┤
|
| 365 |
+
│ eggs │ 451 │
|
| 366 |
+
├────────┼───────┤
|
| 367 |
+
│ bacon │ 0 │
|
| 368 |
+
╘════════╧═══════╛
|
| 369 |
+
|
| 370 |
+
```
|
| 371 |
+
|
| 372 |
+
`colon_grid` is similar to `grid` but uses colons only to define
|
| 373 |
+
columnwise content alignment , without whitespace padding,
|
| 374 |
+
similar the alignment specification of Pandoc `grid_tables`:
|
| 375 |
+
|
| 376 |
+
>>> print(tabulate([["spam", 41.9999], ["eggs", "451.0"]],
|
| 377 |
+
... ["strings", "numbers"], "colon_grid",
|
| 378 |
+
... colalign=["right", "left"]))
|
| 379 |
+
+-----------+-----------+
|
| 380 |
+
| strings | numbers |
|
| 381 |
+
+==========:+:==========+
|
| 382 |
+
| spam | 41.9999 |
|
| 383 |
+
+-----------+-----------+
|
| 384 |
+
| eggs | 451 |
|
| 385 |
+
+-----------+-----------+
|
| 386 |
+
|
| 387 |
+
|
| 388 |
+
`outline` is the same as the `grid` format but doesn't draw lines between rows:
|
| 389 |
+
|
| 390 |
+
>>> print(tabulate(table, headers, tablefmt="outline"))
|
| 391 |
+
+--------+-------+
|
| 392 |
+
| item | qty |
|
| 393 |
+
+========+=======+
|
| 394 |
+
| spam | 42 |
|
| 395 |
+
| eggs | 451 |
|
| 396 |
+
| bacon | 0 |
|
| 397 |
+
+--------+-------+
|
| 398 |
+
|
| 399 |
+
`simple_outline` is the same as the `simple_grid` format but doesn't draw lines between rows:
|
| 400 |
+
|
| 401 |
+
>>> print(tabulate(table, headers, tablefmt="simple_outline"))
|
| 402 |
+
┌────────┬───────┐
|
| 403 |
+
│ item │ qty │
|
| 404 |
+
├────────┼───────┤
|
| 405 |
+
│ spam │ 42 │
|
| 406 |
+
│ eggs │ 451 │
|
| 407 |
+
│ bacon │ 0 │
|
| 408 |
+
└────────┴───────┘
|
| 409 |
+
|
| 410 |
+
`rounded_outline` is the same as the `rounded_grid` format but doesn't draw lines between rows:
|
| 411 |
+
|
| 412 |
+
>>> print(tabulate(table, headers, tablefmt="rounded_outline"))
|
| 413 |
+
╭────────┬───────╮
|
| 414 |
+
│ item │ qty │
|
| 415 |
+
├────────┼───────┤
|
| 416 |
+
│ spam │ 42 │
|
| 417 |
+
│ eggs │ 451 │
|
| 418 |
+
│ bacon │ 0 │
|
| 419 |
+
╰────────┴───────╯
|
| 420 |
+
|
| 421 |
+
`heavy_outline` is the same as the `heavy_grid` format but doesn't draw lines between rows:
|
| 422 |
+
|
| 423 |
+
>>> print(tabulate(table, headers, tablefmt="heavy_outline"))
|
| 424 |
+
┏━━━━━━━━┳━━━━━━━┓
|
| 425 |
+
┃ item ┃ qty ┃
|
| 426 |
+
┣━━━━━━━━╋━━━━━━━┫
|
| 427 |
+
┃ spam ┃ 42 ┃
|
| 428 |
+
┃ eggs ┃ 451 ┃
|
| 429 |
+
┃ bacon ┃ 0 ┃
|
| 430 |
+
┗━━━━━━━━┻━━━━━━━┛
|
| 431 |
+
|
| 432 |
+
`mixed_outline` is the same as the `mixed_grid` format but doesn't draw lines between rows:
|
| 433 |
+
|
| 434 |
+
>>> print(tabulate(table, headers, tablefmt="mixed_outline"))
|
| 435 |
+
┍━━━━━━━━┯━━━━━━━┑
|
| 436 |
+
│ item │ qty │
|
| 437 |
+
┝━━━━━━━━┿━━━━━━━┥
|
| 438 |
+
│ spam │ 42 │
|
| 439 |
+
│ eggs │ 451 │
|
| 440 |
+
│ bacon │ 0 │
|
| 441 |
+
┕━━━━━━━━┷━━━━━━━┙
|
| 442 |
+
|
| 443 |
+
`double_outline` is the same as the `double_grid` format but doesn't draw lines between rows:
|
| 444 |
+
|
| 445 |
+
>>> print(tabulate(table, headers, tablefmt="double_outline"))
|
| 446 |
+
╔════════╦═══════╗
|
| 447 |
+
║ item ║ qty ║
|
| 448 |
+
╠════════╬═══════╣
|
| 449 |
+
║ spam ║ 42 ║
|
| 450 |
+
║ eggs ║ 451 ║
|
| 451 |
+
║ bacon ║ 0 ║
|
| 452 |
+
╚════════╩═══════╝
|
| 453 |
+
|
| 454 |
+
`fancy_outline` is the same as the `fancy_grid` format but doesn't draw lines between rows:
|
| 455 |
+
|
| 456 |
+
>>> print(tabulate(table, headers, tablefmt="fancy_outline"))
|
| 457 |
+
╒════════╤═══════╕
|
| 458 |
+
│ item │ qty │
|
| 459 |
+
╞════════╪═══════╡
|
| 460 |
+
│ spam │ 42 │
|
| 461 |
+
│ eggs │ 451 │
|
| 462 |
+
│ bacon │ 0 │
|
| 463 |
+
╘════════╧═══════╛
|
| 464 |
+
|
| 465 |
+
`presto` is like tables formatted by Presto cli:
|
| 466 |
+
|
| 467 |
+
```pycon
|
| 468 |
+
>>> print(tabulate(table, headers, tablefmt="presto"))
|
| 469 |
+
item | qty
|
| 470 |
+
--------+-------
|
| 471 |
+
spam | 42
|
| 472 |
+
eggs | 451
|
| 473 |
+
bacon | 0
|
| 474 |
+
|
| 475 |
+
```
|
| 476 |
+
|
| 477 |
+
`pretty` attempts to be close to the format emitted by the PrettyTables
|
| 478 |
+
library:
|
| 479 |
+
|
| 480 |
+
```pycon
|
| 481 |
+
>>> print(tabulate(table, headers, tablefmt="pretty"))
|
| 482 |
+
+-------+-----+
|
| 483 |
+
| item | qty |
|
| 484 |
+
+-------+-----+
|
| 485 |
+
| spam | 42 |
|
| 486 |
+
| eggs | 451 |
|
| 487 |
+
| bacon | 0 |
|
| 488 |
+
+-------+-----+
|
| 489 |
+
|
| 490 |
+
```
|
| 491 |
+
|
| 492 |
+
`psql` is like tables formatted by Postgres' psql cli:
|
| 493 |
+
|
| 494 |
+
```pycon
|
| 495 |
+
>>> print(tabulate(table, headers, tablefmt="psql"))
|
| 496 |
+
+--------+-------+
|
| 497 |
+
| item | qty |
|
| 498 |
+
|--------+-------|
|
| 499 |
+
| spam | 42 |
|
| 500 |
+
| eggs | 451 |
|
| 501 |
+
| bacon | 0 |
|
| 502 |
+
+--------+-------+
|
| 503 |
+
|
| 504 |
+
```
|
| 505 |
+
|
| 506 |
+
`pipe` follows the conventions of [PHP Markdown
|
| 507 |
+
Extra](http://michelf.ca/projects/php-markdown/extra/#table) extension.
|
| 508 |
+
It corresponds to `pipe_tables` in Pandoc. This format uses colons to
|
| 509 |
+
indicate column alignment:
|
| 510 |
+
|
| 511 |
+
```pycon
|
| 512 |
+
>>> print(tabulate(table, headers, tablefmt="pipe"))
|
| 513 |
+
| item | qty |
|
| 514 |
+
|:-------|------:|
|
| 515 |
+
| spam | 42 |
|
| 516 |
+
| eggs | 451 |
|
| 517 |
+
| bacon | 0 |
|
| 518 |
+
|
| 519 |
+
```
|
| 520 |
+
|
| 521 |
+
`asciidoc` formats data like a simple table of the
|
| 522 |
+
[AsciiDoctor](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#tables)
|
| 523 |
+
format:
|
| 524 |
+
|
| 525 |
+
```pycon
|
| 526 |
+
>>> print(tabulate(table, headers, tablefmt="asciidoc"))
|
| 527 |
+
[cols="<8,>7",options="header"]
|
| 528 |
+
|====
|
| 529 |
+
| item | qty
|
| 530 |
+
| spam | 42
|
| 531 |
+
| eggs | 451
|
| 532 |
+
| bacon | 0
|
| 533 |
+
|====
|
| 534 |
+
|
| 535 |
+
```
|
| 536 |
+
|
| 537 |
+
`orgtbl` follows the conventions of Emacs
|
| 538 |
+
[org-mode](http://orgmode.org/manual/Tables.html), and is editable also
|
| 539 |
+
in the minor orgtbl-mode. Hence its name:
|
| 540 |
+
|
| 541 |
+
```pycon
|
| 542 |
+
>>> print(tabulate(table, headers, tablefmt="orgtbl"))
|
| 543 |
+
| item | qty |
|
| 544 |
+
|--------+-------|
|
| 545 |
+
| spam | 42 |
|
| 546 |
+
| eggs | 451 |
|
| 547 |
+
| bacon | 0 |
|
| 548 |
+
|
| 549 |
+
```
|
| 550 |
+
|
| 551 |
+
`jira` follows the conventions of Atlassian Jira markup language:
|
| 552 |
+
|
| 553 |
+
```pycon
|
| 554 |
+
>>> print(tabulate(table, headers, tablefmt="jira"))
|
| 555 |
+
|| item || qty ||
|
| 556 |
+
| spam | 42 |
|
| 557 |
+
| eggs | 451 |
|
| 558 |
+
| bacon | 0 |
|
| 559 |
+
|
| 560 |
+
```
|
| 561 |
+
|
| 562 |
+
`rst` formats data like a simple table of the
|
| 563 |
+
[reStructuredText](http://docutils.sourceforge.net/docs/user/rst/quickref.html#tables)
|
| 564 |
+
format:
|
| 565 |
+
|
| 566 |
+
```pycon
|
| 567 |
+
>>> print(tabulate(table, headers, tablefmt="rst"))
|
| 568 |
+
====== =====
|
| 569 |
+
item qty
|
| 570 |
+
====== =====
|
| 571 |
+
spam 42
|
| 572 |
+
eggs 451
|
| 573 |
+
bacon 0
|
| 574 |
+
====== =====
|
| 575 |
+
|
| 576 |
+
```
|
| 577 |
+
|
| 578 |
+
`mediawiki` format produces a table markup used in
|
| 579 |
+
[Wikipedia](http://www.mediawiki.org/wiki/Help:Tables) and on other
|
| 580 |
+
MediaWiki-based sites:
|
| 581 |
+
|
| 582 |
+
```pycon
|
| 583 |
+
>>> print(tabulate(table, headers, tablefmt="mediawiki"))
|
| 584 |
+
{| class="wikitable" style="text-align: left;"
|
| 585 |
+
|+ <!-- caption -->
|
| 586 |
+
|-
|
| 587 |
+
! item !! style="text-align: right;"| qty
|
| 588 |
+
|-
|
| 589 |
+
| spam || style="text-align: right;"| 42
|
| 590 |
+
|-
|
| 591 |
+
| eggs || style="text-align: right;"| 451
|
| 592 |
+
|-
|
| 593 |
+
| bacon || style="text-align: right;"| 0
|
| 594 |
+
|}
|
| 595 |
+
|
| 596 |
+
```
|
| 597 |
+
|
| 598 |
+
`moinmoin` format produces a table markup used in
|
| 599 |
+
[MoinMoin](https://moinmo.in/) wikis:
|
| 600 |
+
|
| 601 |
+
```pycon
|
| 602 |
+
>>> print(tabulate(table, headers, tablefmt="moinmoin"))
|
| 603 |
+
|| ''' item ''' ||<style="text-align: right;"> ''' qty ''' ||
|
| 604 |
+
|| spam ||<style="text-align: right;"> 42 ||
|
| 605 |
+
|| eggs ||<style="text-align: right;"> 451 ||
|
| 606 |
+
|| bacon ||<style="text-align: right;"> 0 ||
|
| 607 |
+
|
| 608 |
+
```
|
| 609 |
+
|
| 610 |
+
`youtrack` format produces a table markup used in Youtrack tickets:
|
| 611 |
+
|
| 612 |
+
```pycon
|
| 613 |
+
>>> print(tabulate(table, headers, tablefmt="youtrack"))
|
| 614 |
+
|| item || qty ||
|
| 615 |
+
| spam | 42 |
|
| 616 |
+
| eggs | 451 |
|
| 617 |
+
| bacon | 0 |
|
| 618 |
+
|
| 619 |
+
```
|
| 620 |
+
|
| 621 |
+
`textile` format produces a table markup used in
|
| 622 |
+
[Textile](http://redcloth.org/hobix.com/textile/) format:
|
| 623 |
+
|
| 624 |
+
```pycon
|
| 625 |
+
>>> print(tabulate(table, headers, tablefmt="textile"))
|
| 626 |
+
|_. item |_. qty |
|
| 627 |
+
|<. spam |>. 42 |
|
| 628 |
+
|<. eggs |>. 451 |
|
| 629 |
+
|<. bacon |>. 0 |
|
| 630 |
+
|
| 631 |
+
```
|
| 632 |
+
|
| 633 |
+
`html` produces standard HTML markup as an html.escape'd str
|
| 634 |
+
with a ._repr_html_ method so that Jupyter Lab and Notebook display the HTML
|
| 635 |
+
and a .str property so that the raw HTML remains accessible.
|
| 636 |
+
`unsafehtml` table format can be used if an unescaped HTML is required:
|
| 637 |
+
|
| 638 |
+
```pycon
|
| 639 |
+
>>> print(tabulate(table, headers, tablefmt="html"))
|
| 640 |
+
<table>
|
| 641 |
+
<thead>
|
| 642 |
+
<tr><th>item </th><th style="text-align: right;"> qty</th></tr>
|
| 643 |
+
</thead>
|
| 644 |
+
<tbody>
|
| 645 |
+
<tr><td>spam </td><td style="text-align: right;"> 42</td></tr>
|
| 646 |
+
<tr><td>eggs </td><td style="text-align: right;"> 451</td></tr>
|
| 647 |
+
<tr><td>bacon </td><td style="text-align: right;"> 0</td></tr>
|
| 648 |
+
</tbody>
|
| 649 |
+
</table>
|
| 650 |
+
|
| 651 |
+
```
|
| 652 |
+
|
| 653 |
+
`latex` format creates a `tabular` environment for LaTeX markup,
|
| 654 |
+
replacing special characters like `_` or `\` to their LaTeX
|
| 655 |
+
correspondents:
|
| 656 |
+
|
| 657 |
+
```pycon
|
| 658 |
+
>>> print(tabulate(table, headers, tablefmt="latex"))
|
| 659 |
+
\begin{tabular}{lr}
|
| 660 |
+
\hline
|
| 661 |
+
item & qty \\
|
| 662 |
+
\hline
|
| 663 |
+
spam & 42 \\
|
| 664 |
+
eggs & 451 \\
|
| 665 |
+
bacon & 0 \\
|
| 666 |
+
\hline
|
| 667 |
+
\end{tabular}
|
| 668 |
+
|
| 669 |
+
```
|
| 670 |
+
|
| 671 |
+
`latex_raw` behaves like `latex` but does not escape LaTeX commands and
|
| 672 |
+
special characters.
|
| 673 |
+
|
| 674 |
+
`latex_booktabs` creates a `tabular` environment for LaTeX markup using
|
| 675 |
+
spacing and style from the `booktabs` package.
|
| 676 |
+
|
| 677 |
+
`latex_longtable` creates a table that can stretch along multiple pages,
|
| 678 |
+
using the `longtable` package.
|
| 679 |
+
|
| 680 |
+
### Column alignment
|
| 681 |
+
|
| 682 |
+
`tabulate` is smart about column alignment. It detects columns which
|
| 683 |
+
contain only numbers, and aligns them by a decimal point (or flushes
|
| 684 |
+
them to the right if they appear to be integers). Text columns are
|
| 685 |
+
flushed to the left.
|
| 686 |
+
|
| 687 |
+
You can override the default alignment with `numalign` and `stralign`
|
| 688 |
+
named arguments. Possible column alignments are: `right`, `center`,
|
| 689 |
+
`left`, `decimal` (only for numbers), and `None` (to disable alignment).
|
| 690 |
+
|
| 691 |
+
Aligning by a decimal point works best when you need to compare numbers
|
| 692 |
+
at a glance:
|
| 693 |
+
|
| 694 |
+
```pycon
|
| 695 |
+
>>> print(tabulate([[1.2345],[123.45],[12.345],[12345],[1234.5]]))
|
| 696 |
+
----------
|
| 697 |
+
1.2345
|
| 698 |
+
123.45
|
| 699 |
+
12.345
|
| 700 |
+
12345
|
| 701 |
+
1234.5
|
| 702 |
+
----------
|
| 703 |
+
|
| 704 |
+
```
|
| 705 |
+
|
| 706 |
+
Compare this with a more common right alignment:
|
| 707 |
+
|
| 708 |
+
```pycon
|
| 709 |
+
>>> print(tabulate([[1.2345],[123.45],[12.345],[12345],[1234.5]], numalign="right"))
|
| 710 |
+
------
|
| 711 |
+
1.2345
|
| 712 |
+
123.45
|
| 713 |
+
12.345
|
| 714 |
+
12345
|
| 715 |
+
1234.5
|
| 716 |
+
------
|
| 717 |
+
|
| 718 |
+
```
|
| 719 |
+
|
| 720 |
+
For `tabulate`, anything which can be parsed as a number is a number.
|
| 721 |
+
Even numbers represented as strings are aligned properly. This feature
|
| 722 |
+
comes in handy when reading a mixed table of text and numbers from a
|
| 723 |
+
file:
|
| 724 |
+
|
| 725 |
+
```pycon
|
| 726 |
+
>>> import csv; from io import StringIO
|
| 727 |
+
>>> table = list(csv.reader(StringIO("spam, 42\neggs, 451\n")))
|
| 728 |
+
>>> table
|
| 729 |
+
[['spam', ' 42'], ['eggs', ' 451']]
|
| 730 |
+
>>> print(tabulate(table))
|
| 731 |
+
---- ----
|
| 732 |
+
spam 42
|
| 733 |
+
eggs 451
|
| 734 |
+
---- ----
|
| 735 |
+
|
| 736 |
+
```
|
| 737 |
+
|
| 738 |
+
To disable this feature use `disable_numparse=True`.
|
| 739 |
+
|
| 740 |
+
```pycon
|
| 741 |
+
>>> print(tabulate([["Ver1", "18.0"], ["Ver2","19.2"]], tablefmt="simple", disable_numparse=True))
|
| 742 |
+
---- ----
|
| 743 |
+
Ver1 18.0
|
| 744 |
+
Ver2 19.2
|
| 745 |
+
---- ----
|
| 746 |
+
|
| 747 |
+
```
|
| 748 |
+
|
| 749 |
+
### Custom column alignment
|
| 750 |
+
|
| 751 |
+
`tabulate` allows a custom column alignment to override the smart alignment described above.
|
| 752 |
+
Use `colglobalalign` to define a global setting. Possible alignments are: `right`, `center`, `left`, `decimal` (only for numbers).
|
| 753 |
+
Furthermore, you can define `colalign` for column-specific alignment as a list or a tuple. Possible values are `global` (keeps global setting), `right`, `center`, `left`, `decimal` (only for numbers), `None` (to disable alignment). Missing alignments are treated as `global`.
|
| 754 |
+
|
| 755 |
+
```pycon
|
| 756 |
+
>>> print(tabulate([[1,2,3,4],[111,222,333,444]], colglobalalign='center', colalign = ('global','left','right')))
|
| 757 |
+
--- --- --- ---
|
| 758 |
+
1 2 3 4
|
| 759 |
+
111 222 333 444
|
| 760 |
+
--- --- --- ---
|
| 761 |
+
|
| 762 |
+
```
|
| 763 |
+
|
| 764 |
+
### Custom header alignment
|
| 765 |
+
|
| 766 |
+
Headers' alignment can be defined separately from columns'. Like for columns, you can use:
|
| 767 |
+
- `headersglobalalign` to define a header-specific global alignment setting. Possible values are `right`, `center`, `left`, `None` (to follow column alignment),
|
| 768 |
+
- `headersalign` list or tuple to further specify header-wise alignment. Possible values are `global` (keeps global setting), `same` (follow column alignment), `right`, `center`, `left`, `None` (to disable alignment). Missing alignments are treated as `global`.
|
| 769 |
+
|
| 770 |
+
```pycon
|
| 771 |
+
>>> print(tabulate([[1,2,3,4,5,6],[111,222,333,444,555,666]], colglobalalign = 'center', colalign = ('left',), headers = ['h','e','a','d','e','r'], headersglobalalign = 'right', headersalign = ('same','same','left','global','center')))
|
| 772 |
+
h e a d e r
|
| 773 |
+
--- --- --- --- --- ---
|
| 774 |
+
1 2 3 4 5 6
|
| 775 |
+
111 222 333 444 555 666
|
| 776 |
+
|
| 777 |
+
```
|
| 778 |
+
|
| 779 |
+
### Number formatting
|
| 780 |
+
|
| 781 |
+
`tabulate` allows to define custom number formatting applied to all
|
| 782 |
+
columns of decimal numbers. Use `floatfmt` named argument:
|
| 783 |
+
|
| 784 |
+
```pycon
|
| 785 |
+
>>> print(tabulate([["pi",3.141593],["e",2.718282]], floatfmt=".4f"))
|
| 786 |
+
-- ------
|
| 787 |
+
pi 3.1416
|
| 788 |
+
e 2.7183
|
| 789 |
+
-- ------
|
| 790 |
+
|
| 791 |
+
```
|
| 792 |
+
|
| 793 |
+
`floatfmt` argument can be a list or a tuple of format strings, one per
|
| 794 |
+
column, in which case every column may have different number formatting:
|
| 795 |
+
|
| 796 |
+
```pycon
|
| 797 |
+
>>> print(tabulate([[0.12345, 0.12345, 0.12345]], floatfmt=(".1f", ".3f")))
|
| 798 |
+
--- ----- -------
|
| 799 |
+
0.1 0.123 0.12345
|
| 800 |
+
--- ----- -------
|
| 801 |
+
|
| 802 |
+
```
|
| 803 |
+
|
| 804 |
+
`intfmt` works similarly for integers
|
| 805 |
+
|
| 806 |
+
>>> print(tabulate([["a",1000],["b",90000]], intfmt=","))
|
| 807 |
+
- ------
|
| 808 |
+
a 1,000
|
| 809 |
+
b 90,000
|
| 810 |
+
- ------
|
| 811 |
+
|
| 812 |
+
|
| 813 |
+
### Type Deduction and Missing Values
|
| 814 |
+
|
| 815 |
+
When `tabulate` sees numerical data (with our without comma separators), it
|
| 816 |
+
attempts to align the column on the decimal point. However, if it observes
|
| 817 |
+
non-numerical data in the column, it aligns it to the left by default. If
|
| 818 |
+
data is missing in a column (either None or empty values), the remaining
|
| 819 |
+
data in the column is used to infer the type:
|
| 820 |
+
|
| 821 |
+
```pycon
|
| 822 |
+
>>> from fractions import Fraction
|
| 823 |
+
>>> test_table = [
|
| 824 |
+
... [None, "1.23423515351", Fraction(1, 3)],
|
| 825 |
+
... [Fraction(56789, 1000000), 12345.1, b"abc"],
|
| 826 |
+
... ["", b"", None],
|
| 827 |
+
... [Fraction(10000, 3), None, ""],
|
| 828 |
+
... ]
|
| 829 |
+
>>> print(tabulate(test_table, floatfmt=",.5g", missingval="?"))
|
| 830 |
+
------------ ----------- ---
|
| 831 |
+
? 1.2342 1/3
|
| 832 |
+
0.056789 12,345 abc
|
| 833 |
+
?
|
| 834 |
+
3,333.3 ?
|
| 835 |
+
------------ ----------- ---
|
| 836 |
+
|
| 837 |
+
```
|
| 838 |
+
|
| 839 |
+
The deduced type (eg. str, float) influences the rendering of any types
|
| 840 |
+
that have alternative representations. For example, since `Fraction` has
|
| 841 |
+
methods `__str__` and `__float__` defined (and hence is convertible to a
|
| 842 |
+
`float` and also has a `str` representation), the appropriate
|
| 843 |
+
representation is selected for the column's deduced type. In order to not
|
| 844 |
+
lose precision accidentally, types having both an `__int__` and
|
| 845 |
+
`__float__` representation will be considered a `float`.
|
| 846 |
+
|
| 847 |
+
Therefore, if your table contains types convertible to int/float but you'd
|
| 848 |
+
*prefer* they be represented as strings, or your strings *might* all look
|
| 849 |
+
like numbers such as "1e23": either convert them to the desired
|
| 850 |
+
representation before you `tabulate`, or ensure that the column always
|
| 851 |
+
contains at least one other `str`.
|
| 852 |
+
|
| 853 |
+
### Text formatting
|
| 854 |
+
|
| 855 |
+
By default, `tabulate` removes leading and trailing whitespace from text
|
| 856 |
+
columns. To disable whitespace removal, pass `preserve_whitespace=True`.
|
| 857 |
+
Older versions of the library used a global module-level flag PRESERVE_WHITESPACE.
|
| 858 |
+
|
| 859 |
+
### Wide (fullwidth CJK) symbols
|
| 860 |
+
|
| 861 |
+
To properly align tables which contain wide characters (typically
|
| 862 |
+
fullwidth glyphs from Chinese, Japanese or Korean languages), the user
|
| 863 |
+
should install `wcwidth` library. To install it together with
|
| 864 |
+
`tabulate`:
|
| 865 |
+
|
| 866 |
+
```shell
|
| 867 |
+
pip install tabulate[widechars]
|
| 868 |
+
```
|
| 869 |
+
|
| 870 |
+
Wide character support is enabled automatically if `wcwidth` library is
|
| 871 |
+
already installed. To disable wide characters support without
|
| 872 |
+
uninstalling `wcwidth`, set the global module-level flag
|
| 873 |
+
`WIDE_CHARS_MODE`:
|
| 874 |
+
|
| 875 |
+
```python
|
| 876 |
+
import tabulate
|
| 877 |
+
tabulate.WIDE_CHARS_MODE = False
|
| 878 |
+
```
|
| 879 |
+
|
| 880 |
+
### Multiline cells
|
| 881 |
+
|
| 882 |
+
Most table formats support multiline cell text (text containing newline
|
| 883 |
+
characters). The newline characters are honored as line break
|
| 884 |
+
characters.
|
| 885 |
+
|
| 886 |
+
Multiline cells are supported for data rows and for header rows.
|
| 887 |
+
|
| 888 |
+
Further automatic line breaks are not inserted. Of course, some output
|
| 889 |
+
formats such as latex or html handle automatic formatting of the cell
|
| 890 |
+
content on their own, but for those that don't, the newline characters
|
| 891 |
+
in the input cell text are the only means to break a line in cell text.
|
| 892 |
+
|
| 893 |
+
Note that some output formats (e.g. simple, or plain) do not represent
|
| 894 |
+
row delimiters, so that the representation of multiline cells in such
|
| 895 |
+
formats may be ambiguous to the reader.
|
| 896 |
+
|
| 897 |
+
The following examples of formatted output use the following table with
|
| 898 |
+
a multiline cell, and headers with a multiline cell:
|
| 899 |
+
|
| 900 |
+
```pycon
|
| 901 |
+
>>> table = [["eggs",451],["more\nspam",42]]
|
| 902 |
+
>>> headers = ["item\nname", "qty"]
|
| 903 |
+
|
| 904 |
+
```
|
| 905 |
+
|
| 906 |
+
`plain` tables:
|
| 907 |
+
|
| 908 |
+
```pycon
|
| 909 |
+
>>> print(tabulate(table, headers, tablefmt="plain"))
|
| 910 |
+
item qty
|
| 911 |
+
name
|
| 912 |
+
eggs 451
|
| 913 |
+
more 42
|
| 914 |
+
spam
|
| 915 |
+
|
| 916 |
+
```
|
| 917 |
+
|
| 918 |
+
`simple` tables:
|
| 919 |
+
|
| 920 |
+
```pycon
|
| 921 |
+
>>> print(tabulate(table, headers, tablefmt="simple"))
|
| 922 |
+
item qty
|
| 923 |
+
name
|
| 924 |
+
------ -----
|
| 925 |
+
eggs 451
|
| 926 |
+
more 42
|
| 927 |
+
spam
|
| 928 |
+
|
| 929 |
+
```
|
| 930 |
+
|
| 931 |
+
`grid` tables:
|
| 932 |
+
|
| 933 |
+
```pycon
|
| 934 |
+
>>> print(tabulate(table, headers, tablefmt="grid"))
|
| 935 |
+
+--------+-------+
|
| 936 |
+
| item | qty |
|
| 937 |
+
| name | |
|
| 938 |
+
+========+=======+
|
| 939 |
+
| eggs | 451 |
|
| 940 |
+
+--------+-------+
|
| 941 |
+
| more | 42 |
|
| 942 |
+
| spam | |
|
| 943 |
+
+--------+-------+
|
| 944 |
+
|
| 945 |
+
```
|
| 946 |
+
|
| 947 |
+
`fancy_grid` tables:
|
| 948 |
+
|
| 949 |
+
```pycon
|
| 950 |
+
>>> print(tabulate(table, headers, tablefmt="fancy_grid"))
|
| 951 |
+
╒════════╤═══════╕
|
| 952 |
+
│ item │ qty │
|
| 953 |
+
│ name │ │
|
| 954 |
+
╞════════╪═══════╡
|
| 955 |
+
│ eggs │ 451 │
|
| 956 |
+
├────────┼───────┤
|
| 957 |
+
│ more │ 42 │
|
| 958 |
+
│ spam │ │
|
| 959 |
+
╘════════╧═══════╛
|
| 960 |
+
|
| 961 |
+
```
|
| 962 |
+
|
| 963 |
+
`pipe` tables:
|
| 964 |
+
|
| 965 |
+
```pycon
|
| 966 |
+
>>> print(tabulate(table, headers, tablefmt="pipe"))
|
| 967 |
+
| item | qty |
|
| 968 |
+
| name | |
|
| 969 |
+
|:-------|------:|
|
| 970 |
+
| eggs | 451 |
|
| 971 |
+
| more | 42 |
|
| 972 |
+
| spam | |
|
| 973 |
+
|
| 974 |
+
```
|
| 975 |
+
|
| 976 |
+
`orgtbl` tables:
|
| 977 |
+
|
| 978 |
+
```pycon
|
| 979 |
+
>>> print(tabulate(table, headers, tablefmt="orgtbl"))
|
| 980 |
+
| item | qty |
|
| 981 |
+
| name | |
|
| 982 |
+
|--------+-------|
|
| 983 |
+
| eggs | 451 |
|
| 984 |
+
| more | 42 |
|
| 985 |
+
| spam | |
|
| 986 |
+
|
| 987 |
+
```
|
| 988 |
+
|
| 989 |
+
`jira` tables:
|
| 990 |
+
|
| 991 |
+
```pycon
|
| 992 |
+
>>> print(tabulate(table, headers, tablefmt="jira"))
|
| 993 |
+
|| item || qty ||
|
| 994 |
+
|| name || ||
|
| 995 |
+
| eggs | 451 |
|
| 996 |
+
| more | 42 |
|
| 997 |
+
| spam | |
|
| 998 |
+
|
| 999 |
+
```
|
| 1000 |
+
|
| 1001 |
+
`presto` tables:
|
| 1002 |
+
|
| 1003 |
+
```pycon
|
| 1004 |
+
>>> print(tabulate(table, headers, tablefmt="presto"))
|
| 1005 |
+
item | qty
|
| 1006 |
+
name |
|
| 1007 |
+
--------+-------
|
| 1008 |
+
eggs | 451
|
| 1009 |
+
more | 42
|
| 1010 |
+
spam |
|
| 1011 |
+
|
| 1012 |
+
```
|
| 1013 |
+
|
| 1014 |
+
`pretty` tables:
|
| 1015 |
+
|
| 1016 |
+
```pycon
|
| 1017 |
+
>>> print(tabulate(table, headers, tablefmt="pretty"))
|
| 1018 |
+
+------+-----+
|
| 1019 |
+
| item | qty |
|
| 1020 |
+
| name | |
|
| 1021 |
+
+------+-----+
|
| 1022 |
+
| eggs | 451 |
|
| 1023 |
+
| more | 42 |
|
| 1024 |
+
| spam | |
|
| 1025 |
+
+------+-----+
|
| 1026 |
+
|
| 1027 |
+
```
|
| 1028 |
+
|
| 1029 |
+
`psql` tables:
|
| 1030 |
+
|
| 1031 |
+
```pycon
|
| 1032 |
+
>>> print(tabulate(table, headers, tablefmt="psql"))
|
| 1033 |
+
+--------+-------+
|
| 1034 |
+
| item | qty |
|
| 1035 |
+
| name | |
|
| 1036 |
+
|--------+-------|
|
| 1037 |
+
| eggs | 451 |
|
| 1038 |
+
| more | 42 |
|
| 1039 |
+
| spam | |
|
| 1040 |
+
+--------+-------+
|
| 1041 |
+
|
| 1042 |
+
```
|
| 1043 |
+
|
| 1044 |
+
`rst` tables:
|
| 1045 |
+
|
| 1046 |
+
```pycon
|
| 1047 |
+
>>> print(tabulate(table, headers, tablefmt="rst"))
|
| 1048 |
+
====== =====
|
| 1049 |
+
item qty
|
| 1050 |
+
name
|
| 1051 |
+
====== =====
|
| 1052 |
+
eggs 451
|
| 1053 |
+
more 42
|
| 1054 |
+
spam
|
| 1055 |
+
====== =====
|
| 1056 |
+
|
| 1057 |
+
```
|
| 1058 |
+
|
| 1059 |
+
Multiline cells are not well-supported for the other table formats.
|
| 1060 |
+
|
| 1061 |
+
### Automating Multilines
|
| 1062 |
+
While tabulate supports data passed in with multilines entries explicitly provided,
|
| 1063 |
+
it also provides some support to help manage this work internally.
|
| 1064 |
+
|
| 1065 |
+
The `maxcolwidths` argument is a list where each entry specifies the max width for
|
| 1066 |
+
it's respective column. Any cell that will exceed this will automatically wrap the content.
|
| 1067 |
+
To assign the same max width for all columns, a singular int scaler can be used.
|
| 1068 |
+
|
| 1069 |
+
Use `None` for any columns where an explicit maximum does not need to be provided,
|
| 1070 |
+
and thus no automate multiline wrapping will take place.
|
| 1071 |
+
|
| 1072 |
+
The wrapping uses the python standard [textwrap.wrap](https://docs.python.org/3/library/textwrap.html#textwrap.wrap)
|
| 1073 |
+
function with default parameters - aside from width.
|
| 1074 |
+
|
| 1075 |
+
This example demonstrates usage of automatic multiline wrapping, though typically
|
| 1076 |
+
the lines being wrapped would probably be significantly longer than this.
|
| 1077 |
+
|
| 1078 |
+
```pycon
|
| 1079 |
+
>>> print(tabulate([["John Smith", "Middle Manager"]], headers=["Name", "Title"], tablefmt="grid", maxcolwidths=[None, 8]))
|
| 1080 |
+
+------------+---------+
|
| 1081 |
+
| Name | Title |
|
| 1082 |
+
+============+=========+
|
| 1083 |
+
| John Smith | Middle |
|
| 1084 |
+
| | Manager |
|
| 1085 |
+
+------------+---------+
|
| 1086 |
+
|
| 1087 |
+
```
|
| 1088 |
+
|
| 1089 |
+
Text is preferably wrapped on whitespaces and right after the hyphens in hyphenated words.
|
| 1090 |
+
|
| 1091 |
+
break_long_words (default: True) If true, then words longer than width will be broken in order to ensure that no lines are longer than width.
|
| 1092 |
+
If it is false, long words will not be broken, and some lines may be longer than width.
|
| 1093 |
+
(Long words will be put on a line by themselves, in order to minimize the amount by which width is exceeded.)
|
| 1094 |
+
|
| 1095 |
+
break_on_hyphens (default: True) If true, wrapping will occur preferably on whitespaces and right after hyphens in compound words, as it is customary in English.
|
| 1096 |
+
If false, only whitespaces will be considered as potentially good places for line breaks.
|
| 1097 |
+
|
| 1098 |
+
```pycon
|
| 1099 |
+
>>> print(tabulate([["John Smith", "Middle-Manager"]], headers=["Name", "Title"], tablefmt="grid", maxcolwidths=[None, 5], break_long_words=False))
|
| 1100 |
+
+------------+---------+
|
| 1101 |
+
| Name | Title |
|
| 1102 |
+
+============+=========+
|
| 1103 |
+
| John Smith | Middle- |
|
| 1104 |
+
| | Manager |
|
| 1105 |
+
+------------+---------+
|
| 1106 |
+
>>> print(tabulate([["John Smith", "Middle-Manager"]], headers=["Name", "Title"], tablefmt="grid", maxcolwidths=[None, 5], break_long_words=False, break_on_hyphens=False))
|
| 1107 |
+
+------------+----------------+
|
| 1108 |
+
| Name | Title |
|
| 1109 |
+
+============+================+
|
| 1110 |
+
| John Smith | Middle-Manager |
|
| 1111 |
+
+------------+----------------+
|
| 1112 |
+
```
|
| 1113 |
+
|
| 1114 |
+
### Adding Separating lines
|
| 1115 |
+
One might want to add one or more separating lines to highlight different sections in a table.
|
| 1116 |
+
|
| 1117 |
+
The separating lines will be of the same type as the one defined by the specified formatter as either the
|
| 1118 |
+
linebetweenrows, linebelowheader, linebelow, lineabove or just a simple empty line when none is defined for the formatter
|
| 1119 |
+
|
| 1120 |
+
|
| 1121 |
+
>>> from tabulate import tabulate, SEPARATING_LINE
|
| 1122 |
+
|
| 1123 |
+
table = [["Earth",6371],
|
| 1124 |
+
["Mars",3390],
|
| 1125 |
+
SEPARATING_LINE,
|
| 1126 |
+
["Moon",1737]]
|
| 1127 |
+
print(tabulate(table, tablefmt="simple"))
|
| 1128 |
+
----- ----
|
| 1129 |
+
Earth 6371
|
| 1130 |
+
Mars 3390
|
| 1131 |
+
----- ----
|
| 1132 |
+
Moon 1737
|
| 1133 |
+
----- ----
|
| 1134 |
+
|
| 1135 |
+
### ANSI support
|
| 1136 |
+
ANSI escape codes are non-printable byte sequences usually used for terminal operations like setting
|
| 1137 |
+
color output or modifying cursor positions. Because multi-byte ANSI sequences are inherently non-printable,
|
| 1138 |
+
they can still introduce unwanted extra length to strings. For example:
|
| 1139 |
+
|
| 1140 |
+
>>> len('\033[31mthis text is red\033[0m') # printable length is 16
|
| 1141 |
+
25
|
| 1142 |
+
|
| 1143 |
+
To deal with this, string lengths are calculated after first removing all ANSI escape sequences. This ensures
|
| 1144 |
+
that the actual printable length is used for column widths, rather than the byte length. In the final, printable
|
| 1145 |
+
table, however, ANSI escape sequences are not removed so the original styling is preserved.
|
| 1146 |
+
|
| 1147 |
+
Some terminals support a special grouping of ANSI escape sequences that are intended to display hyperlinks
|
| 1148 |
+
much in the same way they are shown in browsers. These are handled just as mentioned before: non-printable
|
| 1149 |
+
ANSI escape sequences are removed prior to string length calculation. The only difference with escaped
|
| 1150 |
+
hyperlinks is that column width will be based on the length of the URL _text_ rather than the URL
|
| 1151 |
+
itself (terminals would show this text). For example:
|
| 1152 |
+
|
| 1153 |
+
>>> len('\x1b]8;;https://example.com\x1b\\example\x1b]8;;\x1b\\') # display length is 7, showing 'example'
|
| 1154 |
+
40
|
| 1155 |
+
|
| 1156 |
+
|
| 1157 |
+
Usage of the command line utility
|
| 1158 |
+
---------------------------------
|
| 1159 |
+
|
| 1160 |
+
Usage: tabulate [options] [FILE ...]
|
| 1161 |
+
|
| 1162 |
+
FILE a filename of the file with tabular data;
|
| 1163 |
+
if "-" or missing, read data from stdin.
|
| 1164 |
+
|
| 1165 |
+
Options:
|
| 1166 |
+
|
| 1167 |
+
-h, --help show this message
|
| 1168 |
+
-1, --header use the first row of data as a table header
|
| 1169 |
+
-o FILE, --output FILE print table to FILE (default: stdout)
|
| 1170 |
+
-s REGEXP, --sep REGEXP use a custom column separator (default: whitespace)
|
| 1171 |
+
-F FPFMT, --float FPFMT floating point number format (default: g)
|
| 1172 |
+
-I INTFMT, --int INTFMT integer point number format (default: "")
|
| 1173 |
+
-f FMT, --format FMT set output table format; supported formats:
|
| 1174 |
+
plain, simple, github, grid, fancy_grid, pipe,
|
| 1175 |
+
orgtbl, rst, mediawiki, html, latex, latex_raw,
|
| 1176 |
+
latex_booktabs, latex_longtable, tsv
|
| 1177 |
+
(default: simple)
|
| 1178 |
+
|
| 1179 |
+
Performance considerations
|
| 1180 |
+
--------------------------
|
| 1181 |
+
|
| 1182 |
+
Such features as decimal point alignment and trying to parse everything
|
| 1183 |
+
as a number imply that `tabulate`:
|
| 1184 |
+
|
| 1185 |
+
- has to "guess" how to print a particular tabular data type
|
| 1186 |
+
- needs to keep the entire table in-memory
|
| 1187 |
+
- has to "transpose" the table twice
|
| 1188 |
+
- does much more work than it may appear
|
| 1189 |
+
|
| 1190 |
+
It may not be suitable for serializing really big tables (but who's
|
| 1191 |
+
going to do that, anyway?) or printing tables in performance sensitive
|
| 1192 |
+
applications. `tabulate` is about two orders of magnitude slower than
|
| 1193 |
+
simply joining lists of values with a tab, comma, or other separator.
|
| 1194 |
+
|
| 1195 |
+
At the same time, `tabulate` is comparable to other table
|
| 1196 |
+
pretty-printers. Given a 10x10 table (a list of lists) of mixed text and
|
| 1197 |
+
numeric data, `tabulate` appears to be faster than `PrettyTable` and `texttable`.
|
| 1198 |
+
The following mini-benchmark was run in Python 3.13.7 on Windows 11 (x64):
|
| 1199 |
+
|
| 1200 |
+
================================== ========== ===========
|
| 1201 |
+
Table formatter time, μs rel. time
|
| 1202 |
+
================================== ========== ===========
|
| 1203 |
+
csv to StringIO 11.9 1.0
|
| 1204 |
+
join with tabs and newlines 12.1 1.0
|
| 1205 |
+
PrettyTable (3.17.0) 468.0 39.3
|
| 1206 |
+
tabulate (0.10.0) 553.4 46.5
|
| 1207 |
+
tabulate (0.10.0, WIDE_CHARS_MODE) 612.2 51.4
|
| 1208 |
+
texttable (1.7.0) 1071.4 90.0
|
| 1209 |
+
================================== ========== ===========
|
| 1210 |
+
|
| 1211 |
+
|
| 1212 |
+
Version history
|
| 1213 |
+
---------------
|
| 1214 |
+
|
| 1215 |
+
The full version history can be found at the [changelog](https://github.com/astanin/python-tabulate/blob/master/CHANGELOG).
|
| 1216 |
+
|
| 1217 |
+
How to contribute
|
| 1218 |
+
-----------------
|
| 1219 |
+
|
| 1220 |
+
Contributions should include tests and an explanation for the changes
|
| 1221 |
+
they propose. Documentation (examples, docstrings, README.md) should be
|
| 1222 |
+
updated accordingly.
|
| 1223 |
+
|
| 1224 |
+
This project uses [pytest](https://docs.pytest.org/) testing
|
| 1225 |
+
framework and [tox](https://tox.readthedocs.io/) to automate testing in
|
| 1226 |
+
different environments. Add tests to one of the files in the `test/`
|
| 1227 |
+
folder.
|
| 1228 |
+
|
| 1229 |
+
To run tests on all supported Python versions, make sure all Python
|
| 1230 |
+
interpreters, `pytest` and `tox` are installed, then run `tox` in the root
|
| 1231 |
+
of the project source tree.
|
| 1232 |
+
|
| 1233 |
+
On Linux `tox` expects to find executables like `python3.11`, `python3.12` etc.
|
| 1234 |
+
On Windows it looks for `C:\Python311\python.exe`, `C:\Python312\python.exe` etc. respectively.
|
| 1235 |
+
|
| 1236 |
+
One way to install all the required versions of the Python interpreter is to use [pyenv](https://github.com/pyenv/pyenv).
|
| 1237 |
+
All versions can then be easily installed with something like:
|
| 1238 |
+
|
| 1239 |
+
pyenv install 3.11.7
|
| 1240 |
+
pyenv install 3.12.1
|
| 1241 |
+
...
|
| 1242 |
+
|
| 1243 |
+
Don't forget to change your `PATH` so that `tox` knows how to find all the installed versions. Something like
|
| 1244 |
+
|
| 1245 |
+
export PATH="${PATH}:${HOME}/.pyenv/shims"
|
| 1246 |
+
|
| 1247 |
+
To test only some Python environments, use `-e` option. For example, to
|
| 1248 |
+
test only against Python 3.11 and Python 3.12, run:
|
| 1249 |
+
|
| 1250 |
+
```shell
|
| 1251 |
+
tox -e py311,py312
|
| 1252 |
+
```
|
| 1253 |
+
|
| 1254 |
+
in the root of the project source tree.
|
| 1255 |
+
|
| 1256 |
+
To enable NumPy and Pandas tests, run:
|
| 1257 |
+
|
| 1258 |
+
```shell
|
| 1259 |
+
tox -e py311-extra,py312-extra
|
| 1260 |
+
```
|
| 1261 |
+
|
| 1262 |
+
(this may take a long time the first time, because NumPy and Pandas will
|
| 1263 |
+
have to be installed in the new virtual environments)
|
| 1264 |
+
|
| 1265 |
+
To fix code formatting:
|
| 1266 |
+
|
| 1267 |
+
```shell
|
| 1268 |
+
tox -e lint
|
| 1269 |
+
```
|
| 1270 |
+
|
| 1271 |
+
See `tox.ini` file to learn how to use to test
|
| 1272 |
+
individual Python versions.
|
| 1273 |
+
|
| 1274 |
+
To test the "doctest" examples and their outputs in `README.md`:
|
| 1275 |
+
|
| 1276 |
+
```shell
|
| 1277 |
+
python3 -m pip install pytest-doctestplus[md]
|
| 1278 |
+
python3 -m doctest README.md
|
| 1279 |
+
```
|
| 1280 |
+
|
| 1281 |
+
Contributors
|
| 1282 |
+
------------
|
| 1283 |
+
|
| 1284 |
+
Sergey Astanin, Pau Tallada Crespí, Erwin Marsi, Mik Kocikowski, Bill
|
| 1285 |
+
Ryder, Zach Dwiel, Frederik Rietdijk, Philipp Bogensberger, Greg
|
| 1286 |
+
(anonymous), Stefan Tatschner, Emiel van Miltenburg, Brandon Bennett,
|
| 1287 |
+
Amjith Ramanujam, Jan Schulz, Simon Percivall, Javier Santacruz
|
| 1288 |
+
López-Cepero, Sam Denton, Alexey Ziyangirov, acaird, Cesar Sanchez,
|
| 1289 |
+
naught101, John Vandenberg, Zack Dever, Christian Clauss, Benjamin
|
| 1290 |
+
Maier, Andy MacKinlay, Thomas Roten, Jue Wang, Joe King, Samuel Phan,
|
| 1291 |
+
Nick Satterly, Daniel Robbins, Dmitry B, Lars Butler, Andreas Maier,
|
| 1292 |
+
Dick Marinus, Sébastien Celles, Yago González, Andrew Gaul, Wim Glenn,
|
| 1293 |
+
Jean Michel Rouly, Tim Gates, John Vandenberg, Sorin Sbarnea,
|
| 1294 |
+
Wes Turner, Andrew Tija, Marco Gorelli, Sean McGinnis, danja100,
|
| 1295 |
+
endolith, Dominic Davis-Foster, pavlocat, Daniel Aslau, paulc,
|
| 1296 |
+
Felix Yan, Shane Loretz, Frank Busse, Harsh Singh, Derek Weitzel,
|
| 1297 |
+
Vladimir Vrzić, 서승우 (chrd5273), Georgy Frolov, Christian Cwienk,
|
| 1298 |
+
Bart Broere, Vilhelm Prytz, Alexander Gažo, Hugo van Kemenade,
|
| 1299 |
+
jamescooke, Matt Warner, Jérôme Provensal, Michał Górny, Kevin Deldycke,
|
| 1300 |
+
Kian-Meng Ang, Kevin Patterson, Shodhan Save, cleoold, KOLANICH,
|
| 1301 |
+
Vijaya Krishna Kasula, Furcy Pin, Christian Fibich, Shaun Duncan,
|
| 1302 |
+
Dimitri Papadopoulos, Élie Goudout, Racerroar888, Phill Zarfos,
|
| 1303 |
+
Keyacom, Andrew Coffey, Arpit Jain, Israel Roldan, ilya112358,
|
| 1304 |
+
Dan Nicholson, Frederik Scheerer, cdar07 (cdar), Racerroar888,
|
| 1305 |
+
Perry Kundert.
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/RECORD
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
../../Scripts/tabulate.exe,sha256=8dC7CHe0FiSrZIB3PiLVNTPIfEO5Ybt9ae0DzWCCt2c,46080
|
| 2 |
+
tabulate-0.10.0.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2
|
| 3 |
+
tabulate-0.10.0.dist-info/METADATA,sha256=ON_G22iXRf9MOJCzww735dCxVv2-63ZbkCf9kXBD2Es,40783
|
| 4 |
+
tabulate-0.10.0.dist-info/RECORD,,
|
| 5 |
+
tabulate-0.10.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
| 6 |
+
tabulate-0.10.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
|
| 7 |
+
tabulate-0.10.0.dist-info/entry_points.txt,sha256=8DmChBYma2n4UqC1VkkKbD5Nu4MrdZasURoeTtG0JVo,44
|
| 8 |
+
tabulate-0.10.0.dist-info/licenses/LICENSE,sha256=zfq1DTfY6tBkaPt2o6uvzQXBZ0nsihjuv6UP1Ix8stI,1080
|
| 9 |
+
tabulate-0.10.0.dist-info/top_level.txt,sha256=qfqkQ2az7LTxUeRePtX8ggmh294Kf1ERdI-11aWqFZU,9
|
| 10 |
+
tabulate/__init__.py,sha256=zXgVdl_HW-mp6nY4t607JZ22TMegKmKX88zwGG7JuaI,108269
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/REQUESTED
ADDED
|
File without changes
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: setuptools (82.0.0)
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
| 5 |
+
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
tabulate = tabulate:_main
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2011-2020 Sergey Astanin and contributors
|
| 2 |
+
|
| 3 |
+
Permission is hereby granted, free of charge, to any person obtaining
|
| 4 |
+
a copy of this software and associated documentation files (the
|
| 5 |
+
"Software"), to deal in the Software without restriction, including
|
| 6 |
+
without limitation the rights to use, copy, modify, merge, publish,
|
| 7 |
+
distribute, sublicense, and/or sell copies of the Software, and to
|
| 8 |
+
permit persons to whom the Software is furnished to do so, subject to
|
| 9 |
+
the following conditions:
|
| 10 |
+
|
| 11 |
+
The above copyright notice and this permission notice shall be
|
| 12 |
+
included in all copies or substantial portions of the Software.
|
| 13 |
+
|
| 14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
| 15 |
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
| 16 |
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
| 17 |
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
| 18 |
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
| 19 |
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
| 20 |
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
loan-advisor-agent/.venv/Lib/site-packages/tabulate-0.10.0.dist-info/top_level.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
tabulate
|