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”dp table convert
Section titled “dp table convert”Convert a table from one format to another with support for various input and output formats.
dp 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 Exceldp table convert data.csv data.xlsx
# Convert Excel to JSONdp table convert data.xlsx data.json
# Convert from package resourcedp table convert --from-package datapackage.json --from-resource "users" users.xlsx
# Convert Parquet to CSVdp table convert data.parquet data.csvdp table describe
Section titled “dp table describe”Generate statistical descriptions and summaries of table data including column statistics, data types, and quality metrics.
dp 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 filedp table describe data.csv
# Describe with JSON outputdp table describe data.csv --json
# Describe resource from packagedp table describe --from-package datapackage.json --from-resource "sales"
# Describe remote tabledp table describe https://example.com/data.csvdp table explore
Section titled “dp table explore”Explore a table interactively, viewing data samples, column information, and basic statistics in a rich terminal interface.
dp 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 filedp table explore data.csv
# Explore with schema validationdp table explore data.csv --schema schema.json
# Explore with custom dialectdp table explore data.csv --dialect dialect.json
# Explore resource from packagedp table explore --from-package datapackage.json --from-resource "users"
# Explore remote tabledp table explore https://example.com/data.csvdp table validate
Section titled “dp table validate”Validate table data against a schema, checking data types, constraints, and data quality issues.
dp 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 schemadp table validate data.csv --schema schema.json
# Validate with custom dialect and schemadp table validate data.csv --dialect dialect.json --schema schema.json
# Validate resource from packagedp table validate --from-package datapackage.json --from-resource "users"
# Get validation results as JSONdp table validate data.csv --schema schema.json --json
# Validate remote tabledp table validate https://example.com/data.csv --schema https://example.com/schema.jsondp table script
Section titled “dp 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.
dp 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 tabledp table script data.csv
# Script with schema and dialectdp table script data.csv --schema schema.json --dialect dialect.json
# Script resource from packagedp table script --from-package datapackage.json --from-resource "sales"
# In the REPL session:dp> table.rows.lengthdp> table.columnsdp> table.rows[0]dp> 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 dp table explore data.csv -
Generate statistical summary:
Terminal window dp table describe data.csv -
Interactive analysis:
Terminal window dp table script data.csv
Data Validation Workflow
Section titled “Data Validation Workflow”# Infer schema from tabledp schema infer data.csv --json > schema.json
# Validate table against schemadp table validate data.csv --schema schema.json
# Explore validation issuesdp table explore data.csv --schema schema.jsonFormat Conversion Pipeline
Section titled “Format Conversion Pipeline”# Convert Excel to CSV for processingdp table convert input.xlsx temp.csv
# Process and validatedp table validate temp.csv --schema schema.json
# Convert to final formatdp table convert temp.csv output.jsonPackage Integration Workflow
Section titled “Package Integration Workflow”# Create package with tablesdp package infer *.csv --json > datapackage.json
# Validate individual tablesdp table validate --from-package datapackage.json --from-resource "users"
# Describe tables for documentationdp table describe --from-package datapackage.json --from-resource "sales" --jsonRemote Table Processing
Section titled “Remote Table Processing”# Explore remote tabledp table explore https://example.com/data.csv
# Convert remote to local formatdp table convert https://example.com/data.csv local_data.xlsx
# Validate remote table with local schemadp 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 checkingdp table validate data.csv --schema schema.json
# Explore with schema hintsdp table explore data.csv --schema schema.jsonCustom Parsing
Section titled “Custom Parsing”# Use custom dialect for parsingdp table explore data.csv --dialect custom_dialect.json
# Convert with parsing optionsdp table convert complex_data.csv output.xlsx --dialect dialect.jsonStatistical Analysis
Section titled “Statistical Analysis”# Generate comprehensive statisticsdp table describe large_dataset.csv --json > stats.json
# Interactive statistical explorationdp 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 reportdp table validate data.csv --schema schema.json --json
# Interactive error exploration (don't quit on errors)dp table validate data.csv --schema schema.jsonParsing Problems
Section titled “Parsing Problems”# Debug parsing issuesdp table explore problematic.csv --debug
# Infer and test dialectdp dialect infer problematic.csv --json > dialect.jsondp table explore problematic.csv --dialect dialect.jsonPerformance Optimization
Section titled “Performance Optimization”# For large files, use samplingdp table describe huge_file.csv --sample-rows 10000
# Convert to efficient formats for repeated analysisdp 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 packagedp package infer *.csv --json > datapackage.jsondp table validate --from-package datapackage.json --from-resource "main"With Schema Commands
Section titled “With Schema Commands”# Infer schema and validate tabledp schema infer data.csv --json > schema.jsondp table validate data.csv --schema schema.jsonWith Dialect Commands
Section titled “With Dialect Commands”# Infer dialect and use for table operationsdp dialect infer data.csv --json > dialect.jsondp table explore data.csv --dialect dialect.json