Skip to main content

CLI bringing pandas operations to the command line

Project description

pandas-term

pandas-term is a CLI bringing pandas operations to the command line.

Demo

Note: Still in early experimental development and may change

Installation

pipx install pandas-term

or

uv tool install pandas-term

Usage

All commands accept an input file path (or - for stdin) and support -o/--output for file output (default: stdout).

Command Reference

Command Pandas Equivalent Description
pd select df[columns] Select columns
pd drop df.drop() Drop columns
pd rename df.rename() Rename columns
pd sort df.sort_values() Sort by columns
pd dedup df.drop_duplicates() Remove duplicate rows
pd merge pd.merge() Merge two dataframes
pd concat pd.concat() Concatenate dataframes
pd batch df.iloc[] Split into batches
pd query df.query() Filter with query expr
pd head df.head() First n rows
pd tail df.tail() Last n rows
pd dropna df.dropna() Drop rows with nulls
pd describe df.describe() Descriptive statistics
pd unique df[col].unique() Unique values in column
pd shape df.shape Dimensions (rows, columns)
pd columns df.columns Column names
pd dtypes df.dtypes Column data types
pd value-counts df.value_counts() Count unique values
pd groupby df.groupby().agg() Group by and aggregate

Transform

# Select columns
pd select name,age data.csv

# Drop, sort & rename
pd drop unwanted_column data.csv
pd sort age data.csv --descending
pd rename "name:full_name,age:years" data.csv

# Remove duplicates
pd dedup data.csv
pd dedup --subset name,email data.csv

# Merge two dataframes
pd merge left.csv right.csv --on user_id --how inner

# Concatenate files (supports glob patterns)
pd concat file1.csv file2.csv
pd concat "data_*.csv"

# Split into batches
pd batch data.csv --sizes 100 -o "batch_{}.csv"

Filter

# Query expression
pd query "age > 30 and city == 'NYC'" data.csv

# First/last N rows
pd head --n 100 data.csv
pd tail --n 50 data.csv

# Drop rows with nulls
pd dropna data.csv
pd dropna --subset "name,age" data.csv

Stats

pd describe data.csv
pd unique country data.csv
pd shape data.csv
pd columns data.csv
pd dtypes data.csv

Aggregate

# Count unique values
pd value-counts city data.csv
pd value-counts city,department data.csv --normalize

# Group by and aggregate
pd groupby department data.csv --col salary --agg sum
pd groupby "city,department" data.csv --col salary,age --agg mean

Piping

All commands support piping through stdin/stdout. When piping, you can omit the input file argument (it defaults to stdin):

cat data.csv | pd query "age > 30" | pd select name,age

pd sort age data.csv --descending | pd head --n 10 | pd select name,age

Output Formats

Use -f/--format for stdout format (default: csv):

pd head --n 10 data.csv -f json
pd head --n 10 data.csv -f tsv
pd head --n 10 data.csv -f md

--json/-j is shorthand for -f json.

File output format is determined by extension:

pd select name,age data.csv -o output.xlsx
pd query "age > 30" data.json -o filtered.parquet

Supported: csv, tsv, json, xlsx, parquet, md

For other extensions, use redirection: pd select name data.csv -f csv > output.txt

Dev setup

Requires uv

Install dependencies:

uv sync
Command Description
make check Format, lint, and test
make format Format code
make lint Linting only
make test Run tests
make snapshots Regenerate test snapshots
make coverage Tests with coverage
make bump Bump version number
make demo Regnerate demo gif from tape file

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas_term-0.1.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pandas_term-0.1.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file pandas_term-0.1.0.tar.gz.

File metadata

  • Download URL: pandas_term-0.1.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pandas_term-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0cdaaa75b585747ea13a30997d4a6fbfa06c5cc66ba8428477be21e1e18d9c2
MD5 0d5e8c4389d0c34acb717bcb2dcf2da4
BLAKE2b-256 a306bd48163aab6601da78c82475c0751c4af363ddc0f5e26b18a4ef3afad357

See more details on using hashes here.

Provenance

The following attestation bundles were made for pandas_term-0.1.0.tar.gz:

Publisher: ci.yaml on KatieLG/pandas-term

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pandas_term-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pandas_term-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pandas_term-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f395a508a14c4c61be678d07b70ecaf3b51a719d48494aebcd78ff5c064e420
MD5 8a4ddd21c4cda607dcc4972b519009bf
BLAKE2b-256 554db4a94cb7a6e1dc297f9cac7d8715f567c87f55f8b10eec70871654a298e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pandas_term-0.1.0-py3-none-any.whl:

Publisher: ci.yaml on KatieLG/pandas-term

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page