| 1 |
from __future__ import absolute_import, print_function, division |
| 2 |
|
| 3 |
|
| 4 |
import locale |
| 5 |
from itertools import islice |
| 6 |
from collections import defaultdict |
| 7 |
from petl.compat import numeric_types, text_type |
| 8 |
|
| 9 |
|
| 10 |
from petl import config |
| 11 |
from petl.util.base import Table |
| 12 |
from petl.io.sources import MemorySource |
| 13 |
from petl.io.html import tohtml |
| 14 |
|
| 15 |
|
| 16 |
def look(table, limit=0, vrepr=None, index_header=None, style=None, |
| 17 |
truncate=None, width=None): |
| 18 |
""" |
| 19 |
Format a portion of the table as text for inspection in an interactive |
| 20 |
session. E.g.:: |
| 21 |
|
| 22 |
>>> import petl as etl |
| 23 |
>>> table1 = [['foo', 'bar'], |
| 24 |
... ['a', 1], |
| 25 |
... ['b', 2]] |
| 26 |
>>> etl.look(table1) |
| 27 |
+-----+-----+ |
| 28 |
| foo | bar | |
| 29 |
+=====+=====+ |
| 30 |
| 'a' | 1 | |
| 31 |
+-----+-----+ |
| 32 |
| 'b' | 2 | |
| 33 |
+-----+-----+ |
| 34 |
|
| 35 |
>>> # alternative formatting styles |
| 36 |
... etl.look(table1, style='simple') |
| 37 |
=== === |
| 38 |
foo bar |
| 39 |
=== === |
| 40 |
'a' 1 |
| 41 |
'b' 2 |
| 42 |
=== === |
| 43 |
|
| 44 |
>>> etl.look(table1, style='minimal') |
| 45 |
foo bar |
| 46 |
'a' 1 |
| 47 |
'b' 2 |
| 48 |
|
| 49 |
>>> # any irregularities in the length of header and/or data |
| 50 |
... # rows will appear as blank cells |
| 51 |
... table2 = [['foo', 'bar'], |
| 52 |
... ['a'], |
| 53 |
... ['b', 2, True]] |
| 54 |
>>> etl.look(table2) |
| 55 |
+-----+-----+------+ |
| 56 |
| foo | bar | | |
| 57 |
+=====+=====+======+ |
| 58 |
| 'a' | | | |
| 59 |
+-----+-----+------+ |
| 60 |
| 'b' | 2 | True | |
| 61 |
+-----+-----+------+ |
| 62 |
|
| 63 |
Three alternative presentation styles are available: 'grid', 'simple' and |
| 64 |
'minimal', where 'grid' is the default. A different style can be specified |
| 65 |
using the `style` keyword argument. The default style can also be changed |
| 66 |
by setting ``petl.config.look_style``. |
| 67 |
|
| 68 |
""" |
| 69 |
|
| 70 |
# determine defaults |
| 71 |
if limit == 0: |
| 72 |
limit = config.look_limit |
| 73 |
if vrepr is None: |
| 74 |
vrepr = config.look_vrepr |
| 75 |
if index_header is None: |
| 76 |
index_header = config.look_index_header |
| 77 |
if style is None: |
| 78 |
style = config.look_style |
| 79 |
if width is None: |
| 80 |
width = config.look_width |
| 81 |
|
| 82 |
return Look(table, limit=limit, vrepr=vrepr, index_header=index_header, |
| 83 |
style=style, truncate=truncate, width=width) |
| 84 |
|
| 85 |
|
| 86 |
Table.look = look |
| 87 |
|
| 88 |
|
| 89 |
class Look(object): |
| 90 |
|
| 91 |
def __init__(self, table, limit, vrepr, index_header, style, truncate, |
| 92 |
width): |
| 93 |
self.table = table |
| 94 |
self.limit = limit |
| 95 |
self.vrepr = vrepr |
| 96 |
self.index_header = index_header |
| 97 |
self.style = style |
| 98 |
self.truncate = truncate |
| 99 |
self.width = width |
| 100 |
|
| 101 |
def __repr__(self): |
| 102 |
|
| 103 |
# determine if table overflows limit |
| 104 |
table, overflow = _vis_overflow(self.table, self.limit) |
| 105 |
|
| 106 |
# construct output |
| 107 |
style = self.style |
| 108 |
vrepr = self.vrepr |
| 109 |
index_header = self.index_header |
| 110 |
truncate = self.truncate |
| 111 |
width = self.width |
| 112 |
if style == 'simple': |
| 113 |
output = _look_simple(table, vrepr=vrepr, |
| 114 |
index_header=index_header, |
| 115 |
truncate=truncate, width=width) |
| 116 |
elif style == 'minimal': |
| 117 |
output = _look_minimal(table, vrepr=vrepr, |
| 118 |
index_header=index_header, |
| 119 |
truncate=truncate, width=width) |
| 120 |
else: |
| 121 |
output = _look_grid(table, vrepr=vrepr, index_header=index_header, |
| 122 |
truncate=truncate, width=width) |
| 123 |
|
| 124 |
# add overflow indicator |
| 125 |
if overflow: |
| 126 |
output += '...\n' |
| 127 |
|
| 128 |
return output |
| 129 |
|
| 130 |
__str__ = __repr__ |
| 131 |
__unicode__ = __repr__ |
| 132 |
|
| 133 |
|
| 134 |
def _table_repr(table): |
| 135 |
return str(look(table)) |
| 136 |
|
| 137 |
|
| 138 |
Table.__repr__ = _table_repr |
| 139 |
|
| 140 |
|
| 141 |
def lookall(table, **kwargs): |
| 142 |
""" |
| 143 |
Format the entire table as text for inspection in an interactive session. |
| 144 |
|
| 145 |
N.B., this will load the entire table into memory. |
| 146 |
|
| 147 |
See also :func:`petl.util.vis.look` and :func:`petl.util.vis.see`. |
| 148 |
|
| 149 |
""" |
| 150 |
|
| 151 |
kwargs['limit'] = None |
| 152 |
return look(table, **kwargs) |
| 153 |
|
| 154 |
|
| 155 |
def lookstr(table, limit=0, **kwargs): |
| 156 |
"""Like :func:`petl.util.vis.look` but use str() rather than repr() for data |
| 157 |
values. |
| 158 |
|
| 159 |
""" |
| 160 |
|
| 161 |
kwargs['vrepr'] = str |
| 162 |
return look(table, limit=limit, **kwargs) |
| 163 |
|
| 164 |
|
| 165 |
Table.lookstr = lookstr |
| 166 |
|
| 167 |
|
| 168 |
def _table_str(table): |
| 169 |
return str(lookstr(table)) |
| 170 |
|
| 171 |
|
| 172 |
Table.__str__ = _table_str |
| 173 |
Table.__unicode__ = _table_str |
| 174 |
|
| 175 |
|
| 176 |
def lookallstr(table, **kwargs): |
| 177 |
""" |
| 178 |
Like :func:`petl.util.vis.lookall` but use str() rather than repr() for data |
| 179 |
values. |
| 180 |
|
| 181 |
""" |
| 182 |
|
| 183 |
kwargs['vrepr'] = str |
| 184 |
return lookall(table, **kwargs) |
| 185 |
|
| 186 |
|
| 187 |
Table.lookallstr = lookallstr |
| 188 |
|
| 189 |
|
| 190 |
Table.lookall = lookall |
| 191 |
|
| 192 |
|
| 193 |
def _look_grid(table, vrepr, index_header, truncate, width): |
| 194 |
it = iter(table) |
| 195 |
|
| 196 |
# fields representation |
| 197 |
try: |
| 198 |
hdr = next(it) |
| 199 |
except StopIteration: |
| 200 |
return '' |
| 201 |
flds = list(map(text_type, hdr)) |
| 202 |
if index_header: |
| 203 |
fldsrepr = ['%s|%s' % (i, r) for (i, r) in enumerate(flds)] |
| 204 |
else: |
| 205 |
fldsrepr = flds |
| 206 |
|
| 207 |
# rows representations |
| 208 |
rows = list(it) |
| 209 |
rowsrepr = [[vrepr(v) for v in row] for row in rows] |
| 210 |
|
| 211 |
# find maximum row length - may be uneven |
| 212 |
rowlens = [len(hdr)] |
| 213 |
rowlens.extend([len(row) for row in rows]) |
| 214 |
maxrowlen = max(rowlens) |
| 215 |
|
| 216 |
# pad short fields and rows |
| 217 |
if len(hdr) < maxrowlen: |
| 218 |
fldsrepr.extend([''] * (maxrowlen - len(hdr))) |
| 219 |
for valsrepr in rowsrepr: |
| 220 |
if len(valsrepr) < maxrowlen: |
| 221 |
valsrepr.extend([''] * (maxrowlen - len(valsrepr))) |
| 222 |
|
| 223 |
# truncate |
| 224 |
if truncate: |
| 225 |
fldsrepr = [x[:truncate] for x in fldsrepr] |
| 226 |
rowsrepr = [[x[:truncate] for x in valsrepr] |
| 227 |
for valsrepr in rowsrepr] |
| 228 |
|
| 229 |
# find longest representations so we know how wide to make cells |
| 230 |
colwidths = [0] * maxrowlen # initialise to 0 |
| 231 |
for i, fr in enumerate(fldsrepr): |
| 232 |
colwidths[i] = len(fr) |
| 233 |
for valsrepr in rowsrepr: |
| 234 |
for i, vr in enumerate(valsrepr): |
| 235 |
if len(vr) > colwidths[i]: |
| 236 |
colwidths[i] = len(vr) |
| 237 |
|
| 238 |
# construct a line separator |
| 239 |
sep = '+' |
| 240 |
for w in colwidths: |
| 241 |
sep += '-' * (w + 2) |
| 242 |
sep += '+' |
| 243 |
if width: |
| 244 |
sep = sep[:width] |
| 245 |
sep += '\n' |
| 246 |
|
| 247 |
# construct a header separator |
| 248 |
hedsep = '+' |
| 249 |
for w in colwidths: |
| 250 |
hedsep += '=' * (w + 2) |
| 251 |
hedsep += '+' |
| 252 |
if width: |
| 253 |
hedsep = hedsep[:width] |
| 254 |
hedsep += '\n' |
| 255 |
|
| 256 |
# construct a line for the header row |
| 257 |
fldsline = '|' |
| 258 |
for i, w in enumerate(colwidths): |
| 259 |
f = fldsrepr[i] |
| 260 |
fldsline += ' ' + f |
| 261 |
fldsline += ' ' * (w - len(f)) # padding |
| 262 |
fldsline += ' |' |
| 263 |
if width: |
| 264 |
fldsline = fldsline[:width] |
| 265 |
fldsline += '\n' |
| 266 |
|
| 267 |
# construct a line for each data row |
| 268 |
rowlines = list() |
| 269 |
for vals, valsrepr in zip(rows, rowsrepr): |
| 270 |
rowline = '|' |
| 271 |
for i, w in enumerate(colwidths): |
| 272 |
vr = valsrepr[i] |
| 273 |
if i < len(vals) and isinstance(vals[i], numeric_types) \ |
| 274 |
and not isinstance(vals[i], bool): |
| 275 |
# left pad numbers |
| 276 |
rowline += ' ' * (w + 1 - len(vr)) # padding |
| 277 |
rowline += vr + ' |' |
| 278 |
else: |
| 279 |
# right pad everything else |
| 280 |
rowline += ' ' + vr |
| 281 |
rowline += ' ' * (w - len(vr)) # padding |
| 282 |
rowline += ' |' |
| 283 |
if width: |
| 284 |
rowline = rowline[:width] |
| 285 |
rowline += '\n' |
| 286 |
rowlines.append(rowline) |
| 287 |
|
| 288 |
# put it all together |
| 289 |
output = sep + fldsline + hedsep |
| 290 |
for line in rowlines: |
| 291 |
output += line + sep |
| 292 |
|
| 293 |
return output |
| 294 |
|
| 295 |
|
| 296 |
def _look_simple(table, vrepr, index_header, truncate, width): |
| 297 |
it = iter(table) |
| 298 |
|
| 299 |
# fields representation |
| 300 |
try: |
| 301 |
hdr = next(it) |
| 302 |
except StopIteration: |
| 303 |
return '' |
| 304 |
flds = list(map(text_type, hdr)) |
| 305 |
if index_header: |
| 306 |
fldsrepr = ['%s|%s' % (i, r) for (i, r) in enumerate(flds)] |
| 307 |
else: |
| 308 |
fldsrepr = flds |
| 309 |
|
| 310 |
# rows representations |
| 311 |
rows = list(it) |
| 312 |
rowsrepr = [[vrepr(v) for v in row] for row in rows] |
| 313 |
|
| 314 |
# find maximum row length - may be uneven |
| 315 |
rowlens = [len(hdr)] |
| 316 |
rowlens.extend([len(row) for row in rows]) |
| 317 |
maxrowlen = max(rowlens) |
| 318 |
|
| 319 |
# pad short fields and rows |
| 320 |
if len(hdr) < maxrowlen: |
| 321 |
fldsrepr.extend([''] * (maxrowlen - len(hdr))) |
| 322 |
for valsrepr in rowsrepr: |
| 323 |
if len(valsrepr) < maxrowlen: |
| 324 |
valsrepr.extend([''] * (maxrowlen - len(valsrepr))) |
| 325 |
|
| 326 |
# truncate |
| 327 |
if truncate: |
| 328 |
fldsrepr = [x[:truncate] for x in fldsrepr] |
| 329 |
rowsrepr = [[x[:truncate] for x in valsrepr] |
| 330 |
for valsrepr in rowsrepr] |
| 331 |
|
| 332 |
# find longest representations so we know how wide to make cells |
| 333 |
colwidths = [0] * maxrowlen # initialise to 0 |
| 334 |
for i, fr in enumerate(fldsrepr): |
| 335 |
colwidths[i] = len(fr) |
| 336 |
for valsrepr in rowsrepr: |
| 337 |
for i, vr in enumerate(valsrepr): |
| 338 |
if len(vr) > colwidths[i]: |
| 339 |
colwidths[i] = len(vr) |
| 340 |
|
| 341 |
# construct a header separator |
| 342 |
hedsep = ' '.join('=' * w for w in colwidths) |
| 343 |
if width: |
| 344 |
hedsep = hedsep[:width] |
| 345 |
hedsep += '\n' |
| 346 |
|
| 347 |
# construct a line for the header row |
| 348 |
fldsline = ' '.join(f.ljust(w) for f, w in zip(fldsrepr, colwidths)) |
| 349 |
if width: |
| 350 |
fldsline = fldsline[:width] |
| 351 |
fldsline += '\n' |
| 352 |
|
| 353 |
# construct a line for each data row |
| 354 |
rowlines = list() |
| 355 |
for vals, valsrepr in zip(rows, rowsrepr): |
| 356 |
rowline = '' |
| 357 |
for i, w in enumerate(colwidths): |
| 358 |
vr = valsrepr[i] |
| 359 |
if i < len(vals) and isinstance(vals[i], numeric_types) \ |
| 360 |
and not isinstance(vals[i], bool): |
| 361 |
# left pad numbers |
| 362 |
rowline += vr.rjust(w) |
| 363 |
else: |
| 364 |
# right pad everything else |
| 365 |
rowline += vr.ljust(w) |
| 366 |
if i < len(colwidths) - 1: |
| 367 |
rowline += ' ' |
| 368 |
if width: |
| 369 |
rowline = rowline[:width] |
| 370 |
rowline += '\n' |
| 371 |
rowlines.append(rowline) |
| 372 |
|
| 373 |
# put it all together |
| 374 |
output = hedsep + fldsline + hedsep |
| 375 |
for line in rowlines: |
| 376 |
output += line |
| 377 |
output += hedsep |
| 378 |
|
| 379 |
return output |
| 380 |
|
| 381 |
|
| 382 |
def _look_minimal(table, vrepr, index_header, truncate, width): |
| 383 |
it = iter(table) |
| 384 |
|
| 385 |
# fields representation |
| 386 |
try: |
| 387 |
hdr = next(it) |
| 388 |
except StopIteration: |
| 389 |
return '' |
| 390 |
flds = list(map(text_type, hdr)) |
| 391 |
if index_header: |
| 392 |
fldsrepr = ['%s|%s' % (i, r) for (i, r) in enumerate(flds)] |
| 393 |
else: |
| 394 |
fldsrepr = flds |
| 395 |
|
| 396 |
# rows representations |
| 397 |
rows = list(it) |
| 398 |
rowsrepr = [[vrepr(v) for v in row] for row in rows] |
| 399 |
|
| 400 |
# find maximum row length - may be uneven |
| 401 |
rowlens = [len(hdr)] |
| 402 |
rowlens.extend([len(row) for row in rows]) |
| 403 |
maxrowlen = max(rowlens) |
| 404 |
|
| 405 |
# pad short fields and rows |
| 406 |
if len(hdr) < maxrowlen: |
| 407 |
fldsrepr.extend([''] * (maxrowlen - len(hdr))) |
| 408 |
for valsrepr in rowsrepr: |
| 409 |
if len(valsrepr) < maxrowlen: |
| 410 |
valsrepr.extend([''] * (maxrowlen - len(valsrepr))) |
| 411 |
|
| 412 |
# truncate |
| 413 |
if truncate: |
| 414 |
fldsrepr = [x[:truncate] for x in fldsrepr] |
| 415 |
rowsrepr = [[x[:truncate] for x in valsrepr] |
| 416 |
for valsrepr in rowsrepr] |
| 417 |
|
| 418 |
# find longest representations so we know how wide to make cells |
| 419 |
colwidths = [0] * maxrowlen # initialise to 0 |
| 420 |
for i, fr in enumerate(fldsrepr): |
| 421 |
colwidths[i] = len(fr) |
| 422 |
for valsrepr in rowsrepr: |
| 423 |
for i, vr in enumerate(valsrepr): |
| 424 |
if len(vr) > colwidths[i]: |
| 425 |
colwidths[i] = len(vr) |
| 426 |
|
| 427 |
# construct a line for the header row |
| 428 |
fldsline = ' '.join(f.ljust(w) for f, w in zip(fldsrepr, colwidths)) |
| 429 |
if width: |
| 430 |
fldsline = fldsline[:width] |
| 431 |
fldsline += '\n' |
| 432 |
|
| 433 |
# construct a line for each data row |
| 434 |
rowlines = list() |
| 435 |
for vals, valsrepr in zip(rows, rowsrepr): |
| 436 |
rowline = '' |
| 437 |
for i, w in enumerate(colwidths): |
| 438 |
vr = valsrepr[i] |
| 439 |
if i < len(vals) and isinstance(vals[i], numeric_types) \ |
| 440 |
and not isinstance(vals[i], bool): |
| 441 |
# left pad numbers |
| 442 |
rowline += vr.rjust(w) |
| 443 |
else: |
| 444 |
# right pad everything else |
| 445 |
rowline += vr.ljust(w) |
| 446 |
if i < len(colwidths) - 1: |
| 447 |
rowline += ' ' |
| 448 |
if width: |
| 449 |
rowline = rowline[:width] |
| 450 |
rowline += '\n' |
| 451 |
rowlines.append(rowline) |
| 452 |
|
| 453 |
# put it all together |
| 454 |
output = fldsline |
| 455 |
for line in rowlines: |
| 456 |
output += line |
| 457 |
|
| 458 |
return output |
| 459 |
|
| 460 |
|
| 461 |
def see(table, limit=0, vrepr=None, index_header=None): |
| 462 |
""" |
| 463 |
Format a portion of a table as text in a column-oriented layout for |
| 464 |
inspection in an interactive session. E.g.:: |
| 465 |
|
| 466 |
>>> import petl as etl |
| 467 |
>>> table = [['foo', 'bar'], ['a', 1], ['b', 2]] |
| 468 |
>>> etl.see(table) |
| 469 |
foo: 'a', 'b' |
| 470 |
bar: 1, 2 |
| 471 |
|
| 472 |
Useful for tables with a larger number of fields. |
| 473 |
|
| 474 |
|
| 475 |
""" |
| 476 |
|
| 477 |
# determine defaults |
| 478 |
if limit == 0: |
| 479 |
limit = config.see_limit |
| 480 |
if vrepr is None: |
| 481 |
vrepr = config.see_vrepr |
| 482 |
if index_header is None: |
| 483 |
index_header = config.see_index_header |
| 484 |
|
| 485 |
return See(table, limit=limit, vrepr=vrepr, index_header=index_header) |
| 486 |
|
| 487 |
|
| 488 |
class See(object): |
| 489 |
|
| 490 |
def __init__(self, table, limit, vrepr, index_header): |
| 491 |
self.table = table |
| 492 |
self.limit = limit |
| 493 |
self.vrepr = vrepr |
| 494 |
self.index_header = index_header |
| 495 |
|
| 496 |
def __repr__(self): |
| 497 |
|
| 498 |
# determine if table overflows limit |
| 499 |
table, overflow = _vis_overflow(self.table, self.limit) |
| 500 |
|
| 501 |
vrepr = self.vrepr |
| 502 |
index_header = self.index_header |
| 503 |
|
| 504 |
# construct output |
| 505 |
output = '' |
| 506 |
it = iter(table) |
| 507 |
try: |
| 508 |
flds = next(it) |
| 509 |
except StopIteration: |
| 510 |
return '' |
| 511 |
cols = defaultdict(list) |
| 512 |
for row in it: |
| 513 |
for i, f in enumerate(flds): |
| 514 |
try: |
| 515 |
cols[str(i)].append(vrepr(row[i])) |
| 516 |
except IndexError: |
| 517 |
cols[str(f)].append('') |
| 518 |
for i, f in enumerate(flds): |
| 519 |
if index_header: |
| 520 |
f = '%s|%s' % (i, f) |
| 521 |
output += '%s: %s' % (f, ', '.join(cols[str(i)])) |
| 522 |
if overflow: |
| 523 |
output += '...\n' |
| 524 |
else: |
| 525 |
output += '\n' |
| 526 |
|
| 527 |
return output |
| 528 |
|
| 529 |
__str__ = __repr__ |
| 530 |
__unicode__ = __repr__ |
| 531 |
|
| 532 |
|
| 533 |
Table.see = see |
| 534 |
|
| 535 |
|
| 536 |
def _vis_overflow(table, limit): |
| 537 |
overflow = False |
| 538 |
if limit: |
| 539 |
# try reading one more than the limit, to see if there are more rows |
| 540 |
table = list(islice(table, 0, limit+2)) |
| 541 |
if len(table) > limit+1: |
| 542 |
overflow = True |
| 543 |
table = table[:-1] |
| 544 |
return table, overflow |
| 545 |
|
| 546 |
|
| 547 |
def _display_html(table, limit=0, vrepr=None, index_header=None, caption=None, |
| 548 |
tr_style=None, td_styles=None, encoding=None, |
| 549 |
truncate=None, epilogue=None): |
| 550 |
|
| 551 |
# determine defaults |
| 552 |
if limit == 0: |
| 553 |
limit = config.display_limit |
| 554 |
if vrepr is None: |
| 555 |
vrepr = config.display_vrepr |
| 556 |
if index_header is None: |
| 557 |
index_header = config.display_index_header |
| 558 |
if encoding is None: |
| 559 |
encoding = locale.getpreferredencoding() |
| 560 |
|
| 561 |
table, overflow = _vis_overflow(table, limit) |
| 562 |
buf = MemorySource() |
| 563 |
tohtml(table, buf, encoding=encoding, index_header=index_header, |
| 564 |
vrepr=vrepr, caption=caption, tr_style=tr_style, |
| 565 |
td_styles=td_styles, truncate=truncate) |
| 566 |
output = text_type(buf.getvalue(), encoding) |
| 567 |
|
| 568 |
if epilogue: |
| 569 |
output += '<p>%s</p>' % epilogue |
| 570 |
elif overflow: |
| 571 |
output += '<p><strong>...</strong></p>' |
| 572 |
|
| 573 |
return output |
| 574 |
|
| 575 |
|
| 576 |
Table._repr_html_ = _display_html |
| 577 |
|
| 578 |
|
| 579 |
def display(table, limit=0, vrepr=None, index_header=None, caption=None, |
| 580 |
tr_style=None, td_styles=None, encoding=None, truncate=None, |
| 581 |
epilogue=None): |
| 582 |
""" |
| 583 |
Display a table inline within an IPython notebook. |
| 584 |
|
| 585 |
""" |
| 586 |
|
| 587 |
from IPython.core.display import display_html |
| 588 |
html = _display_html(table, limit=limit, vrepr=vrepr, |
| 589 |
index_header=index_header, caption=caption, |
| 590 |
tr_style=tr_style, td_styles=td_styles, |
| 591 |
encoding=encoding, truncate=truncate, |
| 592 |
epilogue=epilogue) |
| 593 |
display_html(html, raw=True) |
| 594 |
|
| 595 |
|
| 596 |
Table.display = display |
| 597 |
|
| 598 |
|
| 599 |
def displayall(table, **kwargs): |
| 600 |
""" |
| 601 |
Display **all rows** from a table inline within an IPython notebook (use |
| 602 |
with caution, big tables will kill your browser). |
| 603 |
|
| 604 |
""" |
| 605 |
|
| 606 |
kwargs['limit'] = None |
| 607 |
display(table, **kwargs) |
| 608 |
|
| 609 |
|
| 610 |
Table.displayall = displayall |