{"id":8695,"library":"table-logger","title":"TableLogger","description":"TableLogger is a Python utility designed for logging tabular data to either a console or a file. It provides features like sane default formatting for standard Python types, automatically includes row numbers, timestamps, and time deltas, and supports CSV output. Users can also customize column widths and formatting. The library is currently active, with version 0.3.6 being the latest official release on PyPI, though recent GitHub activity shows version 0.3.7. The release cadence appears to be infrequent based on PyPI update history.","status":"active","version":"0.3.6","language":"en","source_language":"en","source_url":"https://github.com/AleksTk/table-logger","tags":["logging","tabular data","console","file","numpy","utility"],"install":[{"cmd":"pip install table-logger","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Required for internal operations; explicitly added as a requirement in v0.3.6.","package":"numpy"}],"imports":[{"symbol":"TableLogger","correct":"from table_logger import TableLogger"}],"quickstart":{"code":"from table_logger import TableLogger\nfrom datetime import datetime\nimport math\nimport random\n\ntbl = TableLogger(columns='a,b,c,d')\ntbl(1, 'Row1', datetime.now(), math.pi)\ntbl(2, 'Row2', datetime.now(), 1/3)\ntbl(3, 'Row3', datetime.now(), random.random())\n\n# Example with additional columns\nimport time\ntbl_extended = TableLogger(columns='data', rownum=True, time_delta=True, timestamp=True)\nfor e in 'abcde':\n    time.sleep(random.uniform(0.1, 0.5)) # Use uniform for more realistic varying delays\n    tbl_extended(e)\n\nprint('\\nStandard Table:')\ntbl.flush()\nprint('\\nExtended Table:')\ntbl_extended.flush()","lang":"python","description":"Initialize a TableLogger instance with specified columns and then log rows. The `flush()` method is implicitly called when the object is garbage collected or the program exits, but can be called explicitly to ensure output. Examples also show enabling row numbers, timestamps, and time deltas."},"warnings":[{"fix":"Upgrade `table-logger` to 0.3.7 or newer once available on PyPI, and ensure your code adapts to modern NumPy type handling (e.g., using `float` or `int` directly where appropriate). Ensure all `numpy` dependent packages are compatible with your `numpy` version.","message":"Version 0.3.7 (GitHub release) removed deprecated `numpy` aliases `np.float` and `np.int`. If you are using an older version of `table-logger` with a very new `numpy` version (e.g., NumPy 2.0+), or your code relies on these aliases in conjunction with `table-logger`, you may encounter errors related to these removed types.","severity":"breaking","affected_versions":"0.3.6 and older when used with newer NumPy versions that have removed these aliases."},{"fix":"Upgrade to `table-logger` version 0.3.5 or newer to resolve known Jupyter notebook logging inconsistencies.","message":"Prior to version 0.3.5, users reported logging issues when `table-logger` was used within Jupyter notebooks, where output might not display correctly or consistently.","severity":"gotcha","affected_versions":"<0.3.5"},{"fix":"Reinstall `table-logger` and its dependencies after upgrading NumPy to ensure they are compiled against the correct NumPy version. Check for `table-logger` releases that explicitly support NumPy 2.0.","message":"NumPy 2.0 (released June 2024) introduced significant breaking changes, including an ABI break and API cleanups. If `table-logger` (or other libraries it depends on) was compiled against an older NumPy 1.x version and then run with NumPy 2.0, this can lead to `ImportError` due to binary incompatibility.","severity":"gotcha","affected_versions":"All versions of `table-logger` when used with NumPy 2.0 if not compiled against it."}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Reinstall `table-logger` and any other packages that depend on NumPy after upgrading NumPy. This ensures they are compiled against the new NumPy ABI. Example: `pip uninstall numpy table-logger && pip install numpy table-logger`.","cause":"This error, particularly after a NumPy upgrade to 2.0+, often indicates an ABI (Application Binary Interface) incompatibility. Python packages that use NumPy's C API and were built against an older NumPy version will not work with NumPy 2.0.","error":"ImportError: numpy.core.multiarray failed to import"},{"fix":"Update to `table-logger` version 0.3.5 or newer: `pip install --upgrade table-logger`.","cause":"Older versions of `table-logger` had specific issues handling output streams in Jupyter environments.","error":"Table output not displaying correctly in Jupyter notebooks."},{"fix":"Upgrade `table-logger` to 0.3.7 (once available on PyPI) or ensure your code is using modern NumPy types (e.g., `float` or `int` directly) and that all dependent libraries are compatible with your NumPy version.","cause":"This typically occurs if your `table-logger` version is older and attempts to use deprecated NumPy aliases like `np.float` or `np.int`, which have been removed in newer NumPy versions. Version 0.3.7 of `table-logger` explicitly removed its internal use of these.","error":"TypeError: 'numpy.float64' object is not callable or AttributeError: module 'numpy' has no attribute 'float'"}]}