...
Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
Filter by Categories
About Article
Analyze Data
Archive
Best Practices
Better Outputs
Blog
Code Optimization
Code Quality
Command Line
Daily tips
Dashboard
Data Analysis & Manipulation
Data Engineer
Data Visualization
DataFrame
Delta Lake
DevOps
DuckDB
Environment Management
Feature Engineer
Git
Jupyter Notebook
LLM
LLM Tools
Machine Learning
Machine Learning & AI
Machine Learning Tools
Manage Data
MLOps
Natural Language Processing
NumPy
Pandas
Polars
PySpark
Python Helpers
Python Tips
Python Utilities
Scrape Data
SQL
Testing
Time Series
Tools
Visualization
Visualization & Reporting
Workflow & Automation
Workflow Automation

csvlens: Fast CSV Viewing Without the Jupyter Overhead

Table of Contents

csvlens: Fast CSV Viewing Without the Jupyter Overhead

The Problem with Jupyter Notebook

Have you ever found yourself wanting to rapidly inspect a large CSV file, only to be slowed down by the time it takes for Jupyter Notebook to launch? And once it’s finally up and running, you’re faced with the hassle of writing multiple lines of code just to catch a glimpse of your data.

# Takes time to start up Jupyter
$ jupyter notebook

# Requires multiple lines of code for basic viewing
import pandas as pd
df = pd.read_csv('large_file.csv')
df.head()

# Need additional code for filtering/searching
df[df['column'].str.contains('pattern')]

Introducing csvlens

csvlens is a command-line tool that allows you to quickly inspect CSV files without the overhead of starting Jupyter Notebook. With csvlens, you can view your data with proper column alignment, filter rows containing specific text, and even show only specific columns – all with just one command.

Here are a few examples of how to use csvlens:

View a CSV file with proper column alignment:

$ csvlens data.csv

This will display the contents of data.csv with properly aligned columns.

Display the contents of data.tsv using tabs as delimiters:

$ csvlens data.tsv -t

Display only the rows in data.csv that contain the text “active”:

$ csvlens data.csv --filter "active"

Display only the “name” and “email” columns from data.csv.:

$ csvlens data.csv --columns "name|email"

Link to csvlens.

1 thought on “csvlens: Fast CSV Viewing Without the Jupyter Overhead”

Leave a Comment

Your email address will not be published. Required fields are marked *

0
    0
    Your Cart
    Your cart is empty
    Scroll to Top

    Work with Khuyen Tran

    Work with Khuyen Tran

    Seraphinite AcceleratorOptimized by Seraphinite Accelerator
    Turns on site high speed to be attractive for people and search engines.