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.
Available Commands
Section titled “Available Commands”dpkit table convert
Section titled “dpkit table convert”Convert a table from one format to another with support for various input and output formats.
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:
# Convert CSV to Exceldpkit table convert data.csv data.xlsx
# Convert Excel to JSONdpkit table convert data.xlsx data.json
# Convert from package resourcedpkit table convert --from-package datapackage.json --from-resource "users" users.xlsx
# Convert Parquet to CSVdpkit table convert data.parquet data.csvdpkit table describe
Section titled “dpkit table describe”Generate statistical descriptions and summaries of table data including column statistics, data types, and quality metrics.
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:
# Describe CSV filedpkit table describe data.csv
# Describe with JSON outputdpkit table describe data.csv --json
# Describe resource from packagedpkit table describe --from-package datapackage.json --from-resource "sales"
# Describe remote tabledpkit table describe https://example.com/data.csvdpkit table explore
Section titled “dpkit table explore”Explore a table interactively, viewing data samples, column information, and basic statistics in a rich terminal interface.
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:
# Explore CSV filedpkit table explore data.csv
# Explore with schema validationdpkit table explore data.csv --schema schema.json
# Explore with custom dialectdpkit table explore data.csv --dialect dialect.json
# Explore resource from packagedpkit table explore --from-package datapackage.json --from-resource "users"
# Explore remote tabledpkit table explore https://example.com/data.csvdpkit table validate
Section titled “dpkit table validate”Validate table data against a schema, checking data types, constraints, and data quality issues.
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:
# Validate with schemadpkit table validate data.csv --schema schema.json
# Validate with custom dialect and schemadpkit table validate data.csv --dialect dialect.json --schema schema.json
# Validate resource from packagedpkit table validate --from-package datapackage.json --from-resource "users"
# Get validation results as JSONdpkit table validate data.csv --schema schema.json --json
# Validate remote tabledpkit table validate https://example.com/data.csv --schema https://example.com/schema.jsondpkit table script
Section titled “dpkit table script”Open an interactive scripting session with a loaded table. This provides a REPL environment where you can programmatically analyze and manipulate table data.
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 objecttable: The loaded table object
Examples:
# Start scripting session with tabledpkit table script data.csv
# Script with schema and dialectdpkit table script data.csv --schema schema.json --dialect dialect.json
# Script resource from packagedpkit table script --from-package datapackage.json --from-resource "sales"
# In the REPL session:dpkit> table.rows.lengthdpkit> table.columnsdpkit> table.rows[0]dpkit> table.schema.fields.map(f => f.name)Common Workflows
Section titled “Common Workflows”Data Exploration and Analysis
Section titled “Data Exploration and Analysis”-
Quick exploration:
Terminal window dpkit table explore data.csv -
Generate statistical summary:
Terminal window dpkit table describe data.csv -
Interactive analysis:
Terminal window dpkit table script data.csv
Data Validation Workflow
Section titled “Data Validation Workflow”# Infer schema from tabledpkit schema infer data.csv --json > schema.json
# Validate table against schemadpkit table validate data.csv --schema schema.json
# Explore validation issuesdpkit table explore data.csv --schema schema.jsonFormat Conversion Pipeline
Section titled “Format Conversion Pipeline”# Convert Excel to CSV for processingdpkit table convert input.xlsx temp.csv
# Process and validatedpkit table validate temp.csv --schema schema.json
# Convert to final formatdpkit table convert temp.csv output.jsonPackage Integration Workflow
Section titled “Package Integration Workflow”# Create package with tablesdpkit package infer *.csv --json > datapackage.json
# Validate individual tablesdpkit table validate --from-package datapackage.json --from-resource "users"
# Describe tables for documentationdpkit table describe --from-package datapackage.json --from-resource "sales" --jsonRemote Table Processing
Section titled “Remote Table Processing”# Explore remote tabledpkit table explore https://example.com/data.csv
# Convert remote to local formatdpkit table convert https://example.com/data.csv local_data.xlsx
# Validate remote table with local schemadpkit table validate https://example.com/data.csv --schema local_schema.jsonSupported File Formats
Section titled “Supported File Formats”Input Formats
Section titled “Input Formats”- 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
Output Formats
Section titled “Output Formats”- CSV: Standard comma-separated values
- Excel: .xlsx format
- JSON: Various JSON structures
- Parquet: Efficient columnar storage
- Arrow: High-performance analytics
- ODS: Cross-platform spreadsheets
Advanced Options
Section titled “Advanced Options”Schema-Aware Operations
Section titled “Schema-Aware Operations”# Validate with type checkingdpkit table validate data.csv --schema schema.json
# Explore with schema hintsdpkit table explore data.csv --schema schema.jsonCustom Parsing
Section titled “Custom Parsing”# Use custom dialect for parsingdpkit table explore data.csv --dialect custom_dialect.json
# Convert with parsing optionsdpkit table convert complex_data.csv output.xlsx --dialect dialect.jsonStatistical Analysis
Section titled “Statistical Analysis”# Generate comprehensive statisticsdpkit table describe large_dataset.csv --json > stats.json
# Interactive statistical explorationdpkit table script data.csv# In REPL: analyze column distributions, correlations, etc.Error Handling and Debugging
Section titled “Error Handling and Debugging”Validation Issues
Section titled “Validation Issues”# Get detailed validation reportdpkit table validate data.csv --schema schema.json --json
# Interactive error exploration (don't quit on errors)dpkit table validate data.csv --schema schema.jsonParsing Problems
Section titled “Parsing Problems”# Debug parsing issuesdpkit table explore problematic.csv --debug
# Infer and test dialectdpkit dialect infer problematic.csv --json > dialect.jsondpkit table explore problematic.csv --dialect dialect.jsonPerformance Optimization
Section titled “Performance Optimization”# For large files, use samplingdpkit table describe huge_file.csv --sample-rows 10000
# Convert to efficient formats for repeated analysisdpkit table convert large_data.csv data.parquetOutput Formats
Section titled “Output Formats”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
Integration Examples
Section titled “Integration Examples”With Package Commands
Section titled “With Package Commands”# Create and validate packagedpkit package infer *.csv --json > datapackage.jsondpkit table validate --from-package datapackage.json --from-resource "main"With Schema Commands
Section titled “With Schema Commands”# Infer schema and validate tabledpkit schema infer data.csv --json > schema.jsondpkit table validate data.csv --schema schema.jsonWith Dialect Commands
Section titled “With Dialect Commands”# Infer dialect and use for table operationsdpkit dialect infer data.csv --json > dialect.jsondpkit table explore data.csv --dialect dialect.json