Tabulator (dataflows-tabulator)

1.54.3 · active · verified Thu Apr 16

Tabulator is a Python library providing a consistent and robust interface for streaming and processing tabular data from various sources and formats, including CSV, Excel, JSON, and SQL databases. It serves as a foundational data reading component within the `dataflows` framework. Currently at version 1.54.3, the library maintains a stable release cadence with regular updates.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to read a local CSV file using `tabulator.Stream`. It opens the stream, prints headers, iterates through rows as lists, and then closes the stream. `headers='first-row'` automatically infers headers from the first row of the data source.

import tabulator
import os

# Example CSV data (in-memory string for quickstart)
csv_data = "id,name\n1,Alice\n2,Bob"

# Create a simple CSV file for demonstration
file_path = 'example.csv'
with open(file_path, 'w', encoding='utf-8') as f:
    f.write(csv_data)

# Read the data using tabulator
# For local files, simply pass the path
table = tabulator.Stream(file_path, headers='first-row')
table.open()

print("Headers:", table.headers)
print("Rows:")
for row in table:
    print(row)

table.close()

# Cleanup (optional)
os.remove(file_path)

view raw JSON →