...

csvlens: Fast CSV Viewing Without the Jupyter Overhead

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.

Search

Related Posts

Leave a Comment

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

Related Posts

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.