Skip to main content

Peek into a dataframe from the command line

Project description

dfpeek

A fast command-line tool for peeking at tabular data files (CSV, TSV, Parquet, Feather, Excel) with concise, chainable options inspired by Unix tools like ls.

Installation

Install from PyPI (recommended):

pip install dfpeek

Or, for Excel/Parquet support:

pip install dfpeek[excel,parquet]

Usage

Run from the command line:

dfpeek <datafile> [options]

Options

Option Description
-f FORMAT Force file format (csv, tsv, excel, parquet, feather)
-d DELIM Set delimiter for CSV/TSV files (e.g., , or \t)
-xs N Select Excel sheet N (1-based indexing)
-xr N Skip first N rows in Excel files
-H N Show first N rows
-T N Show last N rows
-R START END Show rows in range START to END (zero-based, END excl.)
-L EXPR Perform df.loc[expression] for flexible row/column selection
-I EXPR Perform df.iloc[expression] for position-based selection
-u COL Show unique values for column COL
-c COL Show info about column COL (type, nulls, etc.)
-v COL Show value counts for column COL
-s COL Show stats for numerical column COL
-l List column names
-i Show file info (rows, columns, memory usage)

All options can be chained in any order.

Examples

Basic Operations

Show first 10 rows:

dfpeek data.feather -H 10

Show last 5 rows:

dfpeek data.feather -T 5

Show rows 20 to 30:

dfpeek data.feather -R 20 30

Column Analysis

Show unique values for column city:

dfpeek data.feather -u city

Show info about column city:

dfpeek data.feather -c city

Show value counts for column status:

dfpeek data.feather -v status

Show stats for column age:

dfpeek data.feather -s age

File Information

List columns:

dfpeek data.feather -l

Show file info:

dfpeek data.feather -i

Advanced Indexing

Use loc for label-based selection:

# Rows only
dfpeek data.feather -L "0:5"                        # First 5 rows
dfpeek data.feather -L "df.age > 30"                # Rows where age > 30

# Columns only  
dfpeek data.feather -L ":, 'name'"                  # All rows, name column
dfpeek data.feather -L ":, ['name', 'age']"         # All rows, name and age columns

# Both rows and columns
dfpeek data.feather -L "0:5, 'name':'city'"         # First 5 rows, name to city columns
dfpeek data.feather -L "df.age > 25, ['name', 'status']"  # Age > 25, name and status columns

Use iloc for position-based selection:

# Rows only
dfpeek data.feather -I "0:5"                        # First 5 rows
dfpeek data.feather -I "[0,2,4]"                    # Rows at positions 0, 2, 4

# Columns only
dfpeek data.feather -I ":, 0"                       # All rows, first column
dfpeek data.feather -I ":, [0,2]"                   # All rows, columns 0 and 2

# Both rows and columns  
dfpeek data.feather -I "0:5, 0:3"                   # First 5 rows, first 3 columns
dfpeek data.feather -I "[0,2,4], [1,3]"            # Specific rows and columns

Format and Delimiter Options

Force CSV format for files without .csv extension:

dfpeek mydata.txt -f csv

Use custom delimiter:

dfpeek data.tsv -d "\t" -H 5

Default Behavior

Show info and first 5 rows (default if no options):

dfpeek data.feather

Use a specific Excel sheet (e.g., the 3rd sheet):

dfpeek data.xlsx -xs 3 -H 10

Skip the first 2 rows of an excel file:

dfpeek data.xlsx -xr 2 

Supported Formats

  • CSV (.csv)
  • TSV (.tsv)
  • Parquet (.parquet)
  • Feather (.feather)
  • Excel (.xlsx)

Notes

  • For very large files, output may be slow if printing many rows.
  • All rows/columns are shown in full (no abbreviation).
  • Requires Python 3.7+

License

MIT

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

dfpeek-0.1.9.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

dfpeek-0.1.9-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file dfpeek-0.1.9.tar.gz.

File metadata

  • Download URL: dfpeek-0.1.9.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for dfpeek-0.1.9.tar.gz
Algorithm Hash digest
SHA256 7b52c926c2fe5bf39ef4cc85e4f5a679508f4faf6cd31f3015f5546bdec3c9b8
MD5 030ece95c4da5f3936fd8d53ce43b40d
BLAKE2b-256 d965f864e56d21a7b3807b20033e3389a2316eef709a303a02482162d82919f4

See more details on using hashes here.

File details

Details for the file dfpeek-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: dfpeek-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for dfpeek-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 5cca10468dd7a1f0246aaf7a27e6729a9c09eedb52520884c52315b8f45b9683
MD5 e29e95895c0a94725e5aa4b68a5a8ab1
BLAKE2b-256 af5722ea332d8976c6ef0548b64a1d92a93aaf2b953c40d9129f844ce989abb3

See more details on using hashes here.

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