Xan
lastmod 2025-04-09created 2025-04-091 edits
A CSV magician for the terminal, made with Rust (data manipulation, display, visualization, analysis, web scraping, text processing, network analysis, etc.)
Features
- A Rust-based tool for processing large CSV files quickly and efficiently in the terminal
- Besides various data manipulation features, also supports display, visualization, analysis, web scraping, text processing, and network analysis
- Internally uses multithreading, an expression language, and parallel processing for high performance
- Handles very large CSV files (gigabytes) without issue
- Provides a dedicated expression language that is much faster than Python or Lua
- Complex data flows can be built by chaining single commands
- Capable of everything from simple statistics to basic visualizations such as heatmaps and histograms
- Includes advanced features for social science researchers and web data analysis
- Supports Linux, macOS, and Windows
- Automatically recognizes various formats such as .tsv, .psv, .ssv, .gz
Key command examples
- Exploration
- xan headers: print the list of columns
- xan view: view as a table in the terminal
- xan flatten: view all values of a row expanded
- xan hist, xan plot, xan heatmap: visualization features
- xan search -s keyword file.csv: find rows containing a specific keyword
- xan filter 'condition' file.csv: filter rows with an expression
- xan select: select columns
- xan map: create a new column with an expression
- xan transform: change an existing column with an expression
- xan count: count rows
- xan frequency: build a frequency table
- xan stats: print descriptive statistics
- xan agg: custom aggregation
- xan groupby: aggregate per group
- xan sort -s column: sort
- xan dedup -s column: remove duplicates
- xan join: join on a key
- xan merge: merge sorted files
- xan cat: concatenate by rows or columns
- xan map 'fmt("{} ({})", name, foundation_year)' key
- xan filter 'batch > 1'
- xan transform name 'split(name, ".") | first | upper'
- The expression language is a lightweight DSL specialized for CSV manipulation; a cheat sheet, function list, and aggregation function list are available in the official documentation
- xan hist: text-based histograms
- xan plot: scatter plots/line charts
- xan heatmap: correlation heatmaps
- xan view -p: display the whole table in the terminal
Advanced features
- Full support for standard input/output pipelines
- Automatic handling of gzip-compressed files
- Built-in scraping DSL (HTML → CSV conversion)
- lexicometry, fuzzy matching support: tokenize, vocab, cluster
- Network/matrix conversion: network, matrix