A terminal CSV viewer with sorting, filtering, and search capabilities. Explore CSV files directly from your command line with powerful data manipulation features.
- View CSV files with aligned, formatted table output
- Sort by any column (text or numeric, ascending/descending)
- Filter rows by column value (substring or regex)
- Search across all columns simultaneously
- Numeric filtering with comparison operators (
>,<,>=,<=,==,!=) - Column statistics including type detection, min/max/mean for numeric columns
- Auto-detects column types (numeric vs text)
pip install -e .csv-explorer view data.csv# Sort by name (ascending)
csv-explorer view data.csv --sort name
# Sort by age (descending)
csv-explorer view data.csv --sort age --desc# Filter where city contains "New"
csv-explorer view data.csv --filter "city=New"
# Numeric filter: age greater than 30
csv-explorer view data.csv --numeric-filter "age>30"csv-explorer view data.csv --search "Alice"csv-explorer view data.csv --head 10# Stats for all columns
csv-explorer stats data.csv
# Stats for a specific column
csv-explorer stats data.csv --column scorecsv-explorer columns data.csvload_csv(path)� Load a CSV file, returns(headers, rows)parse_csv_text(text)� Parse CSV text contentdetect_column_types(headers, rows)� Detect numeric vs text columnsget_column_stats(headers, rows, col_index)� Compute column statistics
sort_rows(rows, col_index, reverse, numeric)� Sort rows by columnfilter_rows(rows, col_index, pattern, case_sensitive)� Filter by substringfilter_rows_regex(rows, col_index, regex_pattern, case_sensitive)� Filter by regexsearch_all_columns(rows, query, case_sensitive)� Search all columnsapply_numeric_filter(rows, col_index, operator, threshold)� Numeric comparison filter
format_table(headers, rows, max_col_width)� Format data as aligned text tableformat_stats(stats_list)� Format column statistics for display
src/csv_explorer/
��� __init__.py # Package metadata
��� main.py # CLI entry point (click commands)
��� loader.py # CSV loading, parsing, type detection
��� filter_engine.py # Sorting, filtering, search logic
��� formatter.py # Terminal output formatting
The project follows a clean separation of concerns: loader.py handles file I/O and parsing, filter_engine.py contains pure data transformation functions, and formatter.py manages output presentation. The main.py CLI layer orchestrates these components using Click.
MIT License � Copyright 2024 Nripanka Das