---------------
- Added the `Table.present()` method, using the `rich` module to format
table contents into a clean tabular format. Also added notes in the
"How to Use Littletable.txt" file on creating nice tabular output with
`rich`, Jupyter Notebook, and `tabulate`. (Note: `rich` only supports
Python versions 3.6 and later.)
- Added `head(n)` and `tail(n)` methods for easy slicing of the first
or last `n` items in a Table (`n` defaults to 10).
- Added `Table.clear()` method to clear all contents of a Table, but
leaving any index definitions intact.
- Added comparators `Table.between(a, b)`, `Table.within(a, b)`, and
`Table.in_range(a, b)` for easy range testing:
`Table.between(a, b)` matches `a < x < b` exclusive match
`Table.within(a, b)` matches `a <= x <= b` inclusive match
`Table.in_range(a, b)` matches `a <= x < b`, range check, similar
to testing `x in range(a, b)` in Python
- Updated `Table.stats()` to use the Python statistics module for those
versions of Python that support it. The Tables returned from this
method now also include unique indexes to support `.by.name[field_name]`
access to the stats for a particular field, or `.by.stat[stat_name]`
access to a particular stat for all fields, if `Table.stats` is called
with `by_field=False`.
- Fixed `Table.stats()`` to return `None` for `min` and `max` values if
source table is empty. `Table.stats()` also defaults to using all
field names if a list is not given, and guards against non-numeric
data. If `stats()` is called on an empty Table, an empty Table of
statistics is returned.
- Removed sorting of field names in `table.info()["fields"]` so that
attribute names are kept in default order for tabular output.
- Proper definition of `table.all.x` iterators so that `iter(table.all.x)`
returns self. (Necessary for modules like statistics that check
if an iterator is passed by testing `if iter(data) is data`.)
- Added support for a `formats` named argument to `Table.as_html()`.
`formats` takes a dict that maps field names or field data types to
string formats or callables. If a string format, the string should
be of the form used to format a placeholder in the str.format method
(such as "{:5.2f}" for a real value formatted to two decimal places).
If a callable is passed, it should take a single value argument and
return a str.
- Fixed unit tests that fail under Python versions pre-3.6 that do not
preserve dict insertion order. (This was a bug in the unit test, not in
the littletable core code.)