Skip to content

Table

Table commands help you work directly with tabular data files. These commands allow you to explore, validate, convert, and analyze data tables with support for various formats including CSV, Excel, JSON, and more.

Convert a table from one format to another with support for various input and output formats.

Terminal window
dpkit table convert <source-path> <target-path>

Options:

  • -p, --from-package: Path to package containing the resource
  • -r, --from-resource: Name of resource within package
  • -s, --silent: Suppress all output except errors
  • -d, --debug: Enable debug mode

Supported Formats:

  • Input: CSV, TSV, Excel (.xlsx, .xls), JSON, Parquet, Arrow, ODS
  • Output: CSV, TSV, Excel (.xlsx), JSON, Parquet, Arrow, ODS

Examples:

Terminal window
# Convert CSV to Excel
dpkit table convert data.csv data.xlsx
# Convert Excel to JSON
dpkit table convert data.xlsx data.json
# Convert from package resource
dpkit table convert --from-package datapackage.json --from-resource "users" users.xlsx
# Convert Parquet to CSV
dpkit table convert data.parquet data.csv

Generate statistical descriptions and summaries of table data including column statistics, data types, and quality metrics.

Terminal window
dpkit table describe <table-path>

Options:

  • -p, --from-package: Path to package containing the resource
  • -r, --from-resource: Name of resource within package
  • -j, --json: Output as JSON
  • -d, --debug: Enable debug mode

Examples:

Terminal window
# Describe CSV file
dpkit table describe data.csv
# Describe with JSON output
dpkit table describe data.csv --json
# Describe resource from package
dpkit table describe --from-package datapackage.json --from-resource "sales"
# Describe remote table
dpkit table describe https://example.com/data.csv

Explore a table interactively, viewing data samples, column information, and basic statistics in a rich terminal interface.

Terminal window
dpkit table explore <table-path>

Options:

  • --from-package: Path to package containing the resource
  • --from-resource: Name of resource within package
  • --schema: Path to schema file for validation during exploration
  • --dialect: Path to dialect file for parsing configuration
  • --json: Output as JSON
  • --debug: Enable debug mode

Examples:

Terminal window
# Explore CSV file
dpkit table explore data.csv
# Explore with schema validation
dpkit table explore data.csv --schema schema.json
# Explore with custom dialect
dpkit table explore data.csv --dialect dialect.json
# Explore resource from package
dpkit table explore --from-package datapackage.json --from-resource "users"
# Explore remote table
dpkit table explore https://example.com/data.csv

Validate table data against a schema, checking data types, constraints, and data quality issues.

Terminal window
dpkit table validate <table-path>

Options:

  • --from-package: Path to package containing the resource
  • --from-resource: Name of resource within package
  • --schema: Path to schema file for validation
  • --dialect: Path to dialect file for parsing
  • --json: Output validation results as JSON
  • --debug: Enable debug mode
  • -q, --quit: Exit immediately after validation (don’t prompt for error filtering)
  • -a, --all: Skip selection prompts when all can be selected

Examples:

Terminal window
# Validate with schema
dpkit table validate data.csv --schema schema.json
# Validate with custom dialect and schema
dpkit table validate data.csv --dialect dialect.json --schema schema.json
# Validate resource from package
dpkit table validate --from-package datapackage.json --from-resource "users"
# Get validation results as JSON
dpkit table validate data.csv --schema schema.json --json
# Validate remote table
dpkit table validate https://example.com/data.csv --schema https://example.com/schema.json

Open an interactive scripting session with a loaded table. This provides a REPL environment where you can programmatically analyze and manipulate table data.

Terminal window
dpkit table script <table-path>

Options:

  • --from-package: Path to package containing the resource
  • --from-resource: Name of resource within package
  • --schema: Path to schema file
  • --dialect: Path to dialect file
  • --json: Output as JSON
  • --debug: Enable debug mode

Available Variables:

  • dpkit: The dpkit library object
  • table: The loaded table object

Examples:

Terminal window
# Start scripting session with table
dpkit table script data.csv
# Script with schema and dialect
dpkit table script data.csv --schema schema.json --dialect dialect.json
# Script resource from package
dpkit table script --from-package datapackage.json --from-resource "sales"
# In the REPL session:
dpkit> table.rows.length
dpkit> table.columns
dpkit> table.rows[0]
dpkit> table.schema.fields.map(f => f.name)
  1. Quick exploration:

    Terminal window
    dpkit table explore data.csv
  2. Generate statistical summary:

    Terminal window
    dpkit table describe data.csv
  3. Interactive analysis:

    Terminal window
    dpkit table script data.csv
Terminal window
# Infer schema from table
dpkit schema infer data.csv --json > schema.json
# Validate table against schema
dpkit table validate data.csv --schema schema.json
# Explore validation issues
dpkit table explore data.csv --schema schema.json
Terminal window
# Convert Excel to CSV for processing
dpkit table convert input.xlsx temp.csv
# Process and validate
dpkit table validate temp.csv --schema schema.json
# Convert to final format
dpkit table convert temp.csv output.json
Terminal window
# Create package with tables
dpkit package infer *.csv --json > datapackage.json
# Validate individual tables
dpkit table validate --from-package datapackage.json --from-resource "users"
# Describe tables for documentation
dpkit table describe --from-package datapackage.json --from-resource "sales" --json
Terminal window
# Explore remote table
dpkit table explore https://example.com/data.csv
# Convert remote to local format
dpkit table convert https://example.com/data.csv local_data.xlsx
# Validate remote table with local schema
dpkit table validate https://example.com/data.csv --schema local_schema.json
  • CSV/TSV: Comma/tab-separated values with dialect support
  • Excel: .xlsx and .xls files with sheet selection
  • JSON: Various JSON table formats
  • Parquet: Apache Parquet columnar format
  • Arrow: Apache Arrow format
  • ODS: OpenDocument Spreadsheet format
  • CSV: Standard comma-separated values
  • Excel: .xlsx format
  • JSON: Various JSON structures
  • Parquet: Efficient columnar storage
  • Arrow: High-performance analytics
  • ODS: Cross-platform spreadsheets
Terminal window
# Validate with type checking
dpkit table validate data.csv --schema schema.json
# Explore with schema hints
dpkit table explore data.csv --schema schema.json
Terminal window
# Use custom dialect for parsing
dpkit table explore data.csv --dialect custom_dialect.json
# Convert with parsing options
dpkit table convert complex_data.csv output.xlsx --dialect dialect.json
Terminal window
# Generate comprehensive statistics
dpkit table describe large_dataset.csv --json > stats.json
# Interactive statistical exploration
dpkit table script data.csv
# In REPL: analyze column distributions, correlations, etc.
Terminal window
# Get detailed validation report
dpkit table validate data.csv --schema schema.json --json
# Interactive error exploration (don't quit on errors)
dpkit table validate data.csv --schema schema.json
Terminal window
# Debug parsing issues
dpkit table explore problematic.csv --debug
# Infer and test dialect
dpkit dialect infer problematic.csv --json > dialect.json
dpkit table explore problematic.csv --dialect dialect.json
Terminal window
# For large files, use sampling
dpkit table describe huge_file.csv --sample-rows 10000
# Convert to efficient formats for repeated analysis
dpkit table convert large_data.csv data.parquet

Table commands support multiple output formats:

  • Interactive Display: Rich terminal interface with data previews
  • JSON: Machine-readable structured output
  • Statistical Reports: Comprehensive data summaries
  • Debug Mode: Detailed operation logs and diagnostics
Terminal window
# Create and validate package
dpkit package infer *.csv --json > datapackage.json
dpkit table validate --from-package datapackage.json --from-resource "main"
Terminal window
# Infer schema and validate table
dpkit schema infer data.csv --json > schema.json
dpkit table validate data.csv --schema schema.json
Terminal window
# Infer dialect and use for table operations
dpkit dialect infer data.csv --json > dialect.json
dpkit table explore data.csv --dialect dialect.json