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.7.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.7-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dfpeek-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 9171af7f9f9946acbd418d74fc176ceca2e2e49db414337c7578872c2ec55167
MD5 1ae3d2e77f8a69c2b439c452f8e71845
BLAKE2b-256 33eb22feb01424b0b018cfd09adcd5f2f90f5c233f3285f0e0baeb2d4b227227

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dfpeek-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 cd59151e75b8aa68b13ce87b9eaa5a4b3dad03d37876161e9c2ce04ad93da5f5
MD5 d97780b3bb22b55bad35480edc91c3d0
BLAKE2b-256 8f9604d7d141c534a76ff0369dc33040515181db64a2bb94ed7e0c70c1a0528a

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