dataframe-textual 1.3.9__tar.gz → 1.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/PKG-INFO +211 -20
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/README.md +210 -19
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/pyproject.toml +1 -1
- dataframe_textual-1.5.0/src/dataframe_textual/__main__.py +96 -0
- dataframe_textual-1.5.0/src/dataframe_textual/common.py +699 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/data_frame_table.py +586 -351
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/data_frame_viewer.py +11 -6
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/table_screen.py +19 -4
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/yes_no_screen.py +27 -7
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/uv.lock +1 -1
- dataframe_textual-1.3.9/src/dataframe_textual/__main__.py +0 -68
- dataframe_textual-1.3.9/src/dataframe_textual/common.py +0 -482
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/.gitignore +0 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/LICENSE +0 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/main.py +0 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/__init__.py +0 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/data_frame_help_panel.py +0 -0
- {dataframe_textual-1.3.9 → dataframe_textual-1.5.0}/src/dataframe_textual/sql_screen.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataframe-textual
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Summary: Interactive terminal viewer/editor for tabular data
|
|
5
5
|
Project-URL: Homepage, https://github.com/need47/dataframe-textual
|
|
6
6
|
Project-URL: Repository, https://github.com/need47/dataframe-textual.git
|
|
@@ -48,7 +48,21 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/Parquet/J
|
|
|
48
48
|
### Data Viewing
|
|
49
49
|
- 🚀 **Fast Loading** - Powered by Polars for efficient data handling
|
|
50
50
|
- 🎨 **Rich Terminal UI** - Beautiful, color-coded columns with various data types (e.g., integer, float, string)
|
|
51
|
-
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
51
|
+
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
52
|
+
# Skip first 5 lines (comments, metadata)
|
|
53
|
+
dv -l 5 data_with_metadata.csv
|
|
54
|
+
|
|
55
|
+
# Skip 1 row after header (e.g., units row)
|
|
56
|
+
dv -a 1 data_with_units.csv
|
|
57
|
+
|
|
58
|
+
# Complex CSV with comments and units row
|
|
59
|
+
dv -l 3 -a 1 -I messy_scientific_data.csv
|
|
60
|
+
|
|
61
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
62
|
+
dv -l 2 -a 1 -H -I complex_data.csv.gz
|
|
63
|
+
|
|
64
|
+
# Process compressed data from stdin with line skipping
|
|
65
|
+
zcat compressed_data.csv.gz | dv -f csv -l 2editing, and manipulating data
|
|
52
66
|
- 📊 **Flexible Input** - Read from files and/or stdin (pipes/redirects)
|
|
53
67
|
- 🔄 **Smart Pagination** - Lazy load rows on demand for handling large datasets
|
|
54
68
|
|
|
@@ -64,6 +78,7 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/Parquet/J
|
|
|
64
78
|
- 🔄 **Tab Management** - Seamlessly switch between open files with keyboard shortcuts
|
|
65
79
|
- 📌 **Freeze Rows/Columns** - Keep important rows and columns visible while scrolling
|
|
66
80
|
- 🎯 **Cursor Type Cycling** - Switch between cell, row, and column selection modes
|
|
81
|
+
- 🔗 **Link Column Creation** - Generate clickable URLs using template expressions with placeholder support
|
|
67
82
|
|
|
68
83
|
## Installation
|
|
69
84
|
|
|
@@ -129,6 +144,13 @@ uv run python main.py pokemon.csv
|
|
|
129
144
|
# Read from stdin (auto-detects format; defaults to TSV if not recognized)
|
|
130
145
|
cat data.tsv | dv
|
|
131
146
|
dv < data.tsv
|
|
147
|
+
|
|
148
|
+
# Gzipped files are supported
|
|
149
|
+
dv data.csv.gz
|
|
150
|
+
dv large_dataset.tsv.gz
|
|
151
|
+
|
|
152
|
+
# Specify format for gzipped stdin
|
|
153
|
+
zcat data.csv.gz | dv -f csv
|
|
132
154
|
```
|
|
133
155
|
|
|
134
156
|
### Multi-File Usage - Multiple Tabs
|
|
@@ -142,6 +164,9 @@ dv file.xlsx
|
|
|
142
164
|
|
|
143
165
|
# Mix files and stdin (read from stdin, then open file)
|
|
144
166
|
dv data1.tsv < data2.tsv
|
|
167
|
+
|
|
168
|
+
# Mix regular and gzipped files
|
|
169
|
+
dv data1.csv data2.csv.gz data3.tsv.gz
|
|
145
170
|
```
|
|
146
171
|
|
|
147
172
|
When multiple files are opened:
|
|
@@ -151,6 +176,87 @@ When multiple files are opened:
|
|
|
151
176
|
- Close the current tab with `Ctrl+W`
|
|
152
177
|
- Each file maintains its own state (edits, sort order, selections, history, etc.)
|
|
153
178
|
|
|
179
|
+
## Command Line Options
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
usage: dv [-h] [-f {csv,excel,tsv,parquet,json,ndjson}] [-H] [-I] [-E] [-c COMMENT_PREFIX] [-q QUOTE_CHAR] [-l SKIP_LINES] [-a SKIP_ROWS_AFTER_HEADER] [-u NULL [NULL ...]] [files ...]
|
|
183
|
+
|
|
184
|
+
Interactive terminal based viewer/editor for tabular data (e.g., CSV/Excel).
|
|
185
|
+
|
|
186
|
+
positional arguments:
|
|
187
|
+
files Files to view (or read from stdin)
|
|
188
|
+
|
|
189
|
+
options:
|
|
190
|
+
-h, --help show this help message and exit
|
|
191
|
+
-f, --format {csv,excel,tsv,parquet,json,ndjson}
|
|
192
|
+
Specify the format of the input files
|
|
193
|
+
-H, --no-header Specify that input files have no header row
|
|
194
|
+
-I, --no-inferrence Do not infer data types when reading CSV/TSV
|
|
195
|
+
-E, --ignore-errors Ignore errors when reading CSV/TSV
|
|
196
|
+
-c, --comment-prefix COMMENT_PREFIX
|
|
197
|
+
Comment lines are skipped when reading CSV/TSV (default: skip none)
|
|
198
|
+
-q, --quote-char QUOTE_CHAR
|
|
199
|
+
Quote character for reading CSV/TSV (default: "; use None to disable)
|
|
200
|
+
-l, --skip-lines SKIP_LINES
|
|
201
|
+
Skip lines when reading CSV/TSV (default: 0)
|
|
202
|
+
-a, --skip-rows-after-header SKIP_ROWS_AFTER_HEADER
|
|
203
|
+
Skip rows after header when reading CSV/TSV (default: 0)
|
|
204
|
+
-u, --null NULL [NULL ...]
|
|
205
|
+
Values to interpret as null values when reading CSV/TSV
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### CLI Examples
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# View CSV file without header row
|
|
212
|
+
dv -H data_no_header.csv
|
|
213
|
+
|
|
214
|
+
# Disable type inference for faster loading
|
|
215
|
+
dv -I large_data.csv
|
|
216
|
+
|
|
217
|
+
# Ignore parsing errors in malformed CSV
|
|
218
|
+
dv -E data_with_errors.csv
|
|
219
|
+
|
|
220
|
+
# Skip first 3 lines of file (e.g., comments, metadata)
|
|
221
|
+
dv -l 3 data_with_comments.csv
|
|
222
|
+
|
|
223
|
+
# Skip 1 row after header (e.g., units row)
|
|
224
|
+
dv -a 1 data_with_units.csv
|
|
225
|
+
|
|
226
|
+
# Treat specific values as null/missing (e.g., 'NA', 'N/A', '-')
|
|
227
|
+
dv -u NA N/A - data.csv
|
|
228
|
+
|
|
229
|
+
# Multiple null values with different formats
|
|
230
|
+
dv -u NULL NA "" "Not Available" messy_data.csv
|
|
231
|
+
|
|
232
|
+
# Disable quote character processing for TSV with embedded quotes
|
|
233
|
+
dv -q "" data.tsv
|
|
234
|
+
|
|
235
|
+
# Use different quote character (e.g., single quote for CSV)
|
|
236
|
+
dv -q "'" data.csv
|
|
237
|
+
|
|
238
|
+
# Complex CSV with comments and units row
|
|
239
|
+
dv -l 3 -a 1 -I messy_scientific_data.csv
|
|
240
|
+
|
|
241
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
242
|
+
dv -l 2 -a 1 -H -I complex_data.csv.gz
|
|
243
|
+
|
|
244
|
+
# Process compressed data from stdin with line skipping
|
|
245
|
+
zcat compressed_data.csv.gz | dv -f csv -l 2
|
|
246
|
+
|
|
247
|
+
# CSV with custom null values and no header
|
|
248
|
+
dv -H -u NA "N/A" "-" raw_data.csv
|
|
249
|
+
|
|
250
|
+
# Skip lines, specify null values, and disable type inference
|
|
251
|
+
dv -l 5 -u NA "" data_with_metadata.csv
|
|
252
|
+
|
|
253
|
+
# TSV file with problematic quotes in data fields
|
|
254
|
+
dv -q None data.tsv
|
|
255
|
+
|
|
256
|
+
# CSV with comment lines and custom null values
|
|
257
|
+
dv -c "#" -u NA "N/A" commented_data.csv
|
|
258
|
+
```
|
|
259
|
+
|
|
154
260
|
## Keyboard Shortcuts
|
|
155
261
|
|
|
156
262
|
### App-Level Controls
|
|
@@ -189,6 +295,8 @@ When multiple files are opened:
|
|
|
189
295
|
| `Home` / `End` | Jump to first/last column in current row |
|
|
190
296
|
| `Ctrl + Home` / `Ctrl + End` | Jump to top/bottom in current page |
|
|
191
297
|
| `PageDown` / `PageUp` | Scroll down/up one page |
|
|
298
|
+
| `Ctrl+F` | Page down |
|
|
299
|
+
| `Ctrl+B` | Page up |
|
|
192
300
|
|
|
193
301
|
#### Viewing & Display
|
|
194
302
|
|
|
@@ -200,6 +308,7 @@ When multiple files are opened:
|
|
|
200
308
|
| `S` | Show statistics for entire dataframe |
|
|
201
309
|
| `K` | Cycle cursor type: cell → row → column → cell |
|
|
202
310
|
| `~` | Toggle row labels |
|
|
311
|
+
| `_` (underscore) | Expand column to full width |
|
|
203
312
|
|
|
204
313
|
#### Data Editing
|
|
205
314
|
|
|
@@ -211,9 +320,8 @@ When multiple files are opened:
|
|
|
211
320
|
| `E` | Edit entire column with expression |
|
|
212
321
|
| `a` | Add empty column after current |
|
|
213
322
|
| `A` | Add column with name and value/expression |
|
|
323
|
+
| `@` | Add a link column from template expression |
|
|
214
324
|
| `-` (minus) | Delete current column |
|
|
215
|
-
| `_` (underscore) | Delete current column and all columns after |
|
|
216
|
-
| `Ctrl+_` | Delete current column and all columns before |
|
|
217
325
|
| `x` | Delete current row |
|
|
218
326
|
| `X` | Delete current row and all rows below |
|
|
219
327
|
| `Ctrl+X` | Delete current row and all rows above |
|
|
@@ -252,8 +360,8 @@ When multiple files are opened:
|
|
|
252
360
|
|
|
253
361
|
| Key | Action |
|
|
254
362
|
|-----|--------|
|
|
255
|
-
|
|
|
256
|
-
|
|
|
363
|
+
| `;` | Find across all columns with cursor value |
|
|
364
|
+
| `:` | Find across all columns with expression |
|
|
257
365
|
| `r` | Find and replace in current column (interactive or replace all) |
|
|
258
366
|
| `R` | Find and replace across all columns (interactive or replace all) |
|
|
259
367
|
|
|
@@ -281,7 +389,6 @@ When multiple files are opened:
|
|
|
281
389
|
| `%` | Cast current column to float (Float64) |
|
|
282
390
|
| `!` | Cast current column to boolean |
|
|
283
391
|
| `$` | Cast current column to string |
|
|
284
|
-
| `@` | Make URLs in current column clickable with Ctrl/Cmd + click|
|
|
285
392
|
|
|
286
393
|
#### Data Management
|
|
287
394
|
|
|
@@ -329,8 +436,8 @@ The application provides multiple search modes for different use cases:
|
|
|
329
436
|
**Find Operations** - Find by value/expression:
|
|
330
437
|
- **`/` - Column Find**: Find cursor value within current column
|
|
331
438
|
- **`?` - Column Expression Find**: Open dialog to search current column with expression
|
|
332
|
-
-
|
|
333
|
-
-
|
|
439
|
+
- **`;` - Global Find**: Find cursor value across all columns
|
|
440
|
+
- **`:` - Global Expression Find**: Open dialog to search all columns with expression
|
|
334
441
|
|
|
335
442
|
**Selection & Filtering**:
|
|
336
443
|
- **`'` - Toggle Row Selection**: Select/deselect current row (marks it for filtering)
|
|
@@ -703,14 +810,7 @@ Press `K` to cycle through selection modes:
|
|
|
703
810
|
2. **Row mode**: Highlight entire row
|
|
704
811
|
3. **Column mode**: Highlight entire column
|
|
705
812
|
|
|
706
|
-
### 18.
|
|
707
|
-
|
|
708
|
-
Press `@` to make URLs in the current column clickable:
|
|
709
|
-
- **Ctrl/Cmd + click** on URLs to open them in your default browser
|
|
710
|
-
- **Scans** all cells in the current column for URLs starting with `http://` or `https://`
|
|
711
|
-
- **Applies** link styling to make them clickable and dataframe remains unchanged
|
|
712
|
-
|
|
713
|
-
### 19. SQL Interface
|
|
813
|
+
### 18. SQL Interface
|
|
714
814
|
|
|
715
815
|
The SQL interface provides two modes for querying your dataframe:
|
|
716
816
|
|
|
@@ -743,7 +843,7 @@ FROM self
|
|
|
743
843
|
WHERE (age > 25 AND salary > 50000) OR department = 'Management'
|
|
744
844
|
```
|
|
745
845
|
|
|
746
|
-
###
|
|
846
|
+
### 19. Clipboard Operations
|
|
747
847
|
|
|
748
848
|
Copies value to system clipboard with `pbcopy` on macOS and `xclip` on Linux
|
|
749
849
|
|
|
@@ -752,6 +852,73 @@ Press `Ctrl+C` to copy:
|
|
|
752
852
|
- Press `Ctrl+C` to copy column values
|
|
753
853
|
- Press `Ctrl+R` to copy row values (delimited by tab)
|
|
754
854
|
|
|
855
|
+
### 20. Link Column Creation
|
|
856
|
+
|
|
857
|
+
Press `@` to create a new column containing dynamically generated URLs using template expressions.
|
|
858
|
+
|
|
859
|
+
**Template Placeholders:**
|
|
860
|
+
|
|
861
|
+
The link template supports multiple placeholder types for maximum flexibility:
|
|
862
|
+
|
|
863
|
+
- **`$_`** - Current column (the column where cursor was when `@` was pressed)
|
|
864
|
+
- Example: `https://example.com/search/$_` - Uses values from the current column
|
|
865
|
+
- Useful for quick links based on the focused column
|
|
866
|
+
|
|
867
|
+
- **`$1`, `$2`, `$3`, etc.** - Column by 1-based position index
|
|
868
|
+
- Example: `https://example.com/product/$1/details/$2` - Uses 1st and 2nd columns
|
|
869
|
+
- Useful for structured templates spanning multiple columns
|
|
870
|
+
- Index corresponds to column display order (left-to-right)
|
|
871
|
+
|
|
872
|
+
- **`$name`** - Column by name (use actual column names)
|
|
873
|
+
- Example: `https://pubchem.ncbi.nlm.nih.gov/search?q=$product_id` - Uses `product_id` column
|
|
874
|
+
- Example: `https://example.com/$region/$city/data` - Uses `region` and `city` columns
|
|
875
|
+
- Useful for readable, self-documenting templates
|
|
876
|
+
|
|
877
|
+
**Features:**
|
|
878
|
+
|
|
879
|
+
- **Vectorized Expression**: All rows processed efficiently using Polars' vectorized operations
|
|
880
|
+
- **Type Casting**: Column values automatically converted to strings for URL construction
|
|
881
|
+
- **Multiple Placeholders**: Mix and match placeholders in a single template
|
|
882
|
+
- **URL Prefix**: Automatically prepends `https://` if URL doesn't start with `http://` or `https://`
|
|
883
|
+
- **PubChem Support**: Special shorthand - replace `PC` with full PubChem URL
|
|
884
|
+
|
|
885
|
+
**Examples:**
|
|
886
|
+
|
|
887
|
+
```
|
|
888
|
+
Template: https://example.com/$_
|
|
889
|
+
Current column: product_id
|
|
890
|
+
Result: https://example.com/ABC123 (for each row's product_id value)
|
|
891
|
+
|
|
892
|
+
Template: https://database.org/view?id=$1&lang=$2
|
|
893
|
+
Column 1: item_code, Column 2: language
|
|
894
|
+
Result: https://database.org/view?id=X001&lang=en
|
|
895
|
+
|
|
896
|
+
Template: https://example.com/$username/profile
|
|
897
|
+
Column: username (must exist in dataframe)
|
|
898
|
+
Result: https://example.com/john_doe/profile
|
|
899
|
+
|
|
900
|
+
Template: https://example.com/$region/$city
|
|
901
|
+
Columns: region, city
|
|
902
|
+
Result: https://example.com/north/seattle
|
|
903
|
+
|
|
904
|
+
Template: PC/compound/$1
|
|
905
|
+
Column 1: pubchem_cid
|
|
906
|
+
Result: https://pubchem.ncbi.nlm.nih.gov/compound/12345
|
|
907
|
+
```
|
|
908
|
+
|
|
909
|
+
**Error Handling:**
|
|
910
|
+
|
|
911
|
+
- **Invalid column index**: `$5` when only 3 columns exist → Error message showing valid range
|
|
912
|
+
- **Non-existent column name**: `$invalid_column` → Error message with available columns
|
|
913
|
+
- **No placeholders**: Template treated as constant → All rows get identical URL
|
|
914
|
+
|
|
915
|
+
**Tips:**
|
|
916
|
+
|
|
917
|
+
- Use descriptive column names for `$name` placeholders to make templates self-documenting
|
|
918
|
+
- Test with a small dataset first to verify template correctness
|
|
919
|
+
- Use full undo (`u`) if template produces unexpected URLs
|
|
920
|
+
- For complex multi-column URLs, use column names (`$name`) for clarity over positions (`$1`)
|
|
921
|
+
|
|
755
922
|
## Examples
|
|
756
923
|
|
|
757
924
|
### Single File Examples
|
|
@@ -762,6 +929,30 @@ dv pokemon.csv
|
|
|
762
929
|
|
|
763
930
|
# Chain with other command and specify input file format
|
|
764
931
|
cut -d',' -f1,2,3 pokemon.csv | dv -f csv
|
|
932
|
+
|
|
933
|
+
# Work with gzipped files
|
|
934
|
+
dv large_dataset.csv.gz
|
|
935
|
+
|
|
936
|
+
# CSV file without header row
|
|
937
|
+
dv -H raw_data.csv
|
|
938
|
+
|
|
939
|
+
# Skip type inference for faster loading
|
|
940
|
+
dv -I huge_file.csv
|
|
941
|
+
|
|
942
|
+
# Skip first 5 lines (comments, metadata)
|
|
943
|
+
dv -L 5 data_with_metadata.csv
|
|
944
|
+
|
|
945
|
+
# Skip 1 row after header (units row)
|
|
946
|
+
dv -K 1 data_with_units.csv
|
|
947
|
+
|
|
948
|
+
# Complex CSV with comments and units row
|
|
949
|
+
dv -L 3 -K 1 -I messy_scientific_data.csv
|
|
950
|
+
|
|
951
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
952
|
+
dv -L 2 -K 1 -H -I complex_data.csv.gz
|
|
953
|
+
|
|
954
|
+
# Process compressed data from stdin with line skipping
|
|
955
|
+
zcat compressed_data.csv.gz | dv -f csv -L 2
|
|
765
956
|
```
|
|
766
957
|
|
|
767
958
|
### Multi-File/Tab Examples
|
|
@@ -770,8 +961,8 @@ cut -d',' -f1,2,3 pokemon.csv | dv -f csv
|
|
|
770
961
|
# Open multiple sheets as tabs in a single Excel
|
|
771
962
|
dv sales.xlsx
|
|
772
963
|
|
|
773
|
-
# Open multiple files as tabs
|
|
774
|
-
dv pokemon.csv titanic.csv
|
|
964
|
+
# Open multiple files as tabs (including gzipped)
|
|
965
|
+
dv pokemon.csv titanic.csv large_data.csv.gz
|
|
775
966
|
|
|
776
967
|
# Start with one file, then open others using Ctrl+O
|
|
777
968
|
dv initial_data.csv
|
|
@@ -9,7 +9,21 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/Parquet/J
|
|
|
9
9
|
### Data Viewing
|
|
10
10
|
- 🚀 **Fast Loading** - Powered by Polars for efficient data handling
|
|
11
11
|
- 🎨 **Rich Terminal UI** - Beautiful, color-coded columns with various data types (e.g., integer, float, string)
|
|
12
|
-
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
12
|
+
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
13
|
+
# Skip first 5 lines (comments, metadata)
|
|
14
|
+
dv -l 5 data_with_metadata.csv
|
|
15
|
+
|
|
16
|
+
# Skip 1 row after header (e.g., units row)
|
|
17
|
+
dv -a 1 data_with_units.csv
|
|
18
|
+
|
|
19
|
+
# Complex CSV with comments and units row
|
|
20
|
+
dv -l 3 -a 1 -I messy_scientific_data.csv
|
|
21
|
+
|
|
22
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
23
|
+
dv -l 2 -a 1 -H -I complex_data.csv.gz
|
|
24
|
+
|
|
25
|
+
# Process compressed data from stdin with line skipping
|
|
26
|
+
zcat compressed_data.csv.gz | dv -f csv -l 2editing, and manipulating data
|
|
13
27
|
- 📊 **Flexible Input** - Read from files and/or stdin (pipes/redirects)
|
|
14
28
|
- 🔄 **Smart Pagination** - Lazy load rows on demand for handling large datasets
|
|
15
29
|
|
|
@@ -25,6 +39,7 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/Parquet/J
|
|
|
25
39
|
- 🔄 **Tab Management** - Seamlessly switch between open files with keyboard shortcuts
|
|
26
40
|
- 📌 **Freeze Rows/Columns** - Keep important rows and columns visible while scrolling
|
|
27
41
|
- 🎯 **Cursor Type Cycling** - Switch between cell, row, and column selection modes
|
|
42
|
+
- 🔗 **Link Column Creation** - Generate clickable URLs using template expressions with placeholder support
|
|
28
43
|
|
|
29
44
|
## Installation
|
|
30
45
|
|
|
@@ -90,6 +105,13 @@ uv run python main.py pokemon.csv
|
|
|
90
105
|
# Read from stdin (auto-detects format; defaults to TSV if not recognized)
|
|
91
106
|
cat data.tsv | dv
|
|
92
107
|
dv < data.tsv
|
|
108
|
+
|
|
109
|
+
# Gzipped files are supported
|
|
110
|
+
dv data.csv.gz
|
|
111
|
+
dv large_dataset.tsv.gz
|
|
112
|
+
|
|
113
|
+
# Specify format for gzipped stdin
|
|
114
|
+
zcat data.csv.gz | dv -f csv
|
|
93
115
|
```
|
|
94
116
|
|
|
95
117
|
### Multi-File Usage - Multiple Tabs
|
|
@@ -103,6 +125,9 @@ dv file.xlsx
|
|
|
103
125
|
|
|
104
126
|
# Mix files and stdin (read from stdin, then open file)
|
|
105
127
|
dv data1.tsv < data2.tsv
|
|
128
|
+
|
|
129
|
+
# Mix regular and gzipped files
|
|
130
|
+
dv data1.csv data2.csv.gz data3.tsv.gz
|
|
106
131
|
```
|
|
107
132
|
|
|
108
133
|
When multiple files are opened:
|
|
@@ -112,6 +137,87 @@ When multiple files are opened:
|
|
|
112
137
|
- Close the current tab with `Ctrl+W`
|
|
113
138
|
- Each file maintains its own state (edits, sort order, selections, history, etc.)
|
|
114
139
|
|
|
140
|
+
## Command Line Options
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
usage: dv [-h] [-f {csv,excel,tsv,parquet,json,ndjson}] [-H] [-I] [-E] [-c COMMENT_PREFIX] [-q QUOTE_CHAR] [-l SKIP_LINES] [-a SKIP_ROWS_AFTER_HEADER] [-u NULL [NULL ...]] [files ...]
|
|
144
|
+
|
|
145
|
+
Interactive terminal based viewer/editor for tabular data (e.g., CSV/Excel).
|
|
146
|
+
|
|
147
|
+
positional arguments:
|
|
148
|
+
files Files to view (or read from stdin)
|
|
149
|
+
|
|
150
|
+
options:
|
|
151
|
+
-h, --help show this help message and exit
|
|
152
|
+
-f, --format {csv,excel,tsv,parquet,json,ndjson}
|
|
153
|
+
Specify the format of the input files
|
|
154
|
+
-H, --no-header Specify that input files have no header row
|
|
155
|
+
-I, --no-inferrence Do not infer data types when reading CSV/TSV
|
|
156
|
+
-E, --ignore-errors Ignore errors when reading CSV/TSV
|
|
157
|
+
-c, --comment-prefix COMMENT_PREFIX
|
|
158
|
+
Comment lines are skipped when reading CSV/TSV (default: skip none)
|
|
159
|
+
-q, --quote-char QUOTE_CHAR
|
|
160
|
+
Quote character for reading CSV/TSV (default: "; use None to disable)
|
|
161
|
+
-l, --skip-lines SKIP_LINES
|
|
162
|
+
Skip lines when reading CSV/TSV (default: 0)
|
|
163
|
+
-a, --skip-rows-after-header SKIP_ROWS_AFTER_HEADER
|
|
164
|
+
Skip rows after header when reading CSV/TSV (default: 0)
|
|
165
|
+
-u, --null NULL [NULL ...]
|
|
166
|
+
Values to interpret as null values when reading CSV/TSV
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### CLI Examples
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# View CSV file without header row
|
|
173
|
+
dv -H data_no_header.csv
|
|
174
|
+
|
|
175
|
+
# Disable type inference for faster loading
|
|
176
|
+
dv -I large_data.csv
|
|
177
|
+
|
|
178
|
+
# Ignore parsing errors in malformed CSV
|
|
179
|
+
dv -E data_with_errors.csv
|
|
180
|
+
|
|
181
|
+
# Skip first 3 lines of file (e.g., comments, metadata)
|
|
182
|
+
dv -l 3 data_with_comments.csv
|
|
183
|
+
|
|
184
|
+
# Skip 1 row after header (e.g., units row)
|
|
185
|
+
dv -a 1 data_with_units.csv
|
|
186
|
+
|
|
187
|
+
# Treat specific values as null/missing (e.g., 'NA', 'N/A', '-')
|
|
188
|
+
dv -u NA N/A - data.csv
|
|
189
|
+
|
|
190
|
+
# Multiple null values with different formats
|
|
191
|
+
dv -u NULL NA "" "Not Available" messy_data.csv
|
|
192
|
+
|
|
193
|
+
# Disable quote character processing for TSV with embedded quotes
|
|
194
|
+
dv -q "" data.tsv
|
|
195
|
+
|
|
196
|
+
# Use different quote character (e.g., single quote for CSV)
|
|
197
|
+
dv -q "'" data.csv
|
|
198
|
+
|
|
199
|
+
# Complex CSV with comments and units row
|
|
200
|
+
dv -l 3 -a 1 -I messy_scientific_data.csv
|
|
201
|
+
|
|
202
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
203
|
+
dv -l 2 -a 1 -H -I complex_data.csv.gz
|
|
204
|
+
|
|
205
|
+
# Process compressed data from stdin with line skipping
|
|
206
|
+
zcat compressed_data.csv.gz | dv -f csv -l 2
|
|
207
|
+
|
|
208
|
+
# CSV with custom null values and no header
|
|
209
|
+
dv -H -u NA "N/A" "-" raw_data.csv
|
|
210
|
+
|
|
211
|
+
# Skip lines, specify null values, and disable type inference
|
|
212
|
+
dv -l 5 -u NA "" data_with_metadata.csv
|
|
213
|
+
|
|
214
|
+
# TSV file with problematic quotes in data fields
|
|
215
|
+
dv -q None data.tsv
|
|
216
|
+
|
|
217
|
+
# CSV with comment lines and custom null values
|
|
218
|
+
dv -c "#" -u NA "N/A" commented_data.csv
|
|
219
|
+
```
|
|
220
|
+
|
|
115
221
|
## Keyboard Shortcuts
|
|
116
222
|
|
|
117
223
|
### App-Level Controls
|
|
@@ -150,6 +256,8 @@ When multiple files are opened:
|
|
|
150
256
|
| `Home` / `End` | Jump to first/last column in current row |
|
|
151
257
|
| `Ctrl + Home` / `Ctrl + End` | Jump to top/bottom in current page |
|
|
152
258
|
| `PageDown` / `PageUp` | Scroll down/up one page |
|
|
259
|
+
| `Ctrl+F` | Page down |
|
|
260
|
+
| `Ctrl+B` | Page up |
|
|
153
261
|
|
|
154
262
|
#### Viewing & Display
|
|
155
263
|
|
|
@@ -161,6 +269,7 @@ When multiple files are opened:
|
|
|
161
269
|
| `S` | Show statistics for entire dataframe |
|
|
162
270
|
| `K` | Cycle cursor type: cell → row → column → cell |
|
|
163
271
|
| `~` | Toggle row labels |
|
|
272
|
+
| `_` (underscore) | Expand column to full width |
|
|
164
273
|
|
|
165
274
|
#### Data Editing
|
|
166
275
|
|
|
@@ -172,9 +281,8 @@ When multiple files are opened:
|
|
|
172
281
|
| `E` | Edit entire column with expression |
|
|
173
282
|
| `a` | Add empty column after current |
|
|
174
283
|
| `A` | Add column with name and value/expression |
|
|
284
|
+
| `@` | Add a link column from template expression |
|
|
175
285
|
| `-` (minus) | Delete current column |
|
|
176
|
-
| `_` (underscore) | Delete current column and all columns after |
|
|
177
|
-
| `Ctrl+_` | Delete current column and all columns before |
|
|
178
286
|
| `x` | Delete current row |
|
|
179
287
|
| `X` | Delete current row and all rows below |
|
|
180
288
|
| `Ctrl+X` | Delete current row and all rows above |
|
|
@@ -213,8 +321,8 @@ When multiple files are opened:
|
|
|
213
321
|
|
|
214
322
|
| Key | Action |
|
|
215
323
|
|-----|--------|
|
|
216
|
-
|
|
|
217
|
-
|
|
|
324
|
+
| `;` | Find across all columns with cursor value |
|
|
325
|
+
| `:` | Find across all columns with expression |
|
|
218
326
|
| `r` | Find and replace in current column (interactive or replace all) |
|
|
219
327
|
| `R` | Find and replace across all columns (interactive or replace all) |
|
|
220
328
|
|
|
@@ -242,7 +350,6 @@ When multiple files are opened:
|
|
|
242
350
|
| `%` | Cast current column to float (Float64) |
|
|
243
351
|
| `!` | Cast current column to boolean |
|
|
244
352
|
| `$` | Cast current column to string |
|
|
245
|
-
| `@` | Make URLs in current column clickable with Ctrl/Cmd + click|
|
|
246
353
|
|
|
247
354
|
#### Data Management
|
|
248
355
|
|
|
@@ -290,8 +397,8 @@ The application provides multiple search modes for different use cases:
|
|
|
290
397
|
**Find Operations** - Find by value/expression:
|
|
291
398
|
- **`/` - Column Find**: Find cursor value within current column
|
|
292
399
|
- **`?` - Column Expression Find**: Open dialog to search current column with expression
|
|
293
|
-
-
|
|
294
|
-
-
|
|
400
|
+
- **`;` - Global Find**: Find cursor value across all columns
|
|
401
|
+
- **`:` - Global Expression Find**: Open dialog to search all columns with expression
|
|
295
402
|
|
|
296
403
|
**Selection & Filtering**:
|
|
297
404
|
- **`'` - Toggle Row Selection**: Select/deselect current row (marks it for filtering)
|
|
@@ -664,14 +771,7 @@ Press `K` to cycle through selection modes:
|
|
|
664
771
|
2. **Row mode**: Highlight entire row
|
|
665
772
|
3. **Column mode**: Highlight entire column
|
|
666
773
|
|
|
667
|
-
### 18.
|
|
668
|
-
|
|
669
|
-
Press `@` to make URLs in the current column clickable:
|
|
670
|
-
- **Ctrl/Cmd + click** on URLs to open them in your default browser
|
|
671
|
-
- **Scans** all cells in the current column for URLs starting with `http://` or `https://`
|
|
672
|
-
- **Applies** link styling to make them clickable and dataframe remains unchanged
|
|
673
|
-
|
|
674
|
-
### 19. SQL Interface
|
|
774
|
+
### 18. SQL Interface
|
|
675
775
|
|
|
676
776
|
The SQL interface provides two modes for querying your dataframe:
|
|
677
777
|
|
|
@@ -704,7 +804,7 @@ FROM self
|
|
|
704
804
|
WHERE (age > 25 AND salary > 50000) OR department = 'Management'
|
|
705
805
|
```
|
|
706
806
|
|
|
707
|
-
###
|
|
807
|
+
### 19. Clipboard Operations
|
|
708
808
|
|
|
709
809
|
Copies value to system clipboard with `pbcopy` on macOS and `xclip` on Linux
|
|
710
810
|
|
|
@@ -713,6 +813,73 @@ Press `Ctrl+C` to copy:
|
|
|
713
813
|
- Press `Ctrl+C` to copy column values
|
|
714
814
|
- Press `Ctrl+R` to copy row values (delimited by tab)
|
|
715
815
|
|
|
816
|
+
### 20. Link Column Creation
|
|
817
|
+
|
|
818
|
+
Press `@` to create a new column containing dynamically generated URLs using template expressions.
|
|
819
|
+
|
|
820
|
+
**Template Placeholders:**
|
|
821
|
+
|
|
822
|
+
The link template supports multiple placeholder types for maximum flexibility:
|
|
823
|
+
|
|
824
|
+
- **`$_`** - Current column (the column where cursor was when `@` was pressed)
|
|
825
|
+
- Example: `https://example.com/search/$_` - Uses values from the current column
|
|
826
|
+
- Useful for quick links based on the focused column
|
|
827
|
+
|
|
828
|
+
- **`$1`, `$2`, `$3`, etc.** - Column by 1-based position index
|
|
829
|
+
- Example: `https://example.com/product/$1/details/$2` - Uses 1st and 2nd columns
|
|
830
|
+
- Useful for structured templates spanning multiple columns
|
|
831
|
+
- Index corresponds to column display order (left-to-right)
|
|
832
|
+
|
|
833
|
+
- **`$name`** - Column by name (use actual column names)
|
|
834
|
+
- Example: `https://pubchem.ncbi.nlm.nih.gov/search?q=$product_id` - Uses `product_id` column
|
|
835
|
+
- Example: `https://example.com/$region/$city/data` - Uses `region` and `city` columns
|
|
836
|
+
- Useful for readable, self-documenting templates
|
|
837
|
+
|
|
838
|
+
**Features:**
|
|
839
|
+
|
|
840
|
+
- **Vectorized Expression**: All rows processed efficiently using Polars' vectorized operations
|
|
841
|
+
- **Type Casting**: Column values automatically converted to strings for URL construction
|
|
842
|
+
- **Multiple Placeholders**: Mix and match placeholders in a single template
|
|
843
|
+
- **URL Prefix**: Automatically prepends `https://` if URL doesn't start with `http://` or `https://`
|
|
844
|
+
- **PubChem Support**: Special shorthand - replace `PC` with full PubChem URL
|
|
845
|
+
|
|
846
|
+
**Examples:**
|
|
847
|
+
|
|
848
|
+
```
|
|
849
|
+
Template: https://example.com/$_
|
|
850
|
+
Current column: product_id
|
|
851
|
+
Result: https://example.com/ABC123 (for each row's product_id value)
|
|
852
|
+
|
|
853
|
+
Template: https://database.org/view?id=$1&lang=$2
|
|
854
|
+
Column 1: item_code, Column 2: language
|
|
855
|
+
Result: https://database.org/view?id=X001&lang=en
|
|
856
|
+
|
|
857
|
+
Template: https://example.com/$username/profile
|
|
858
|
+
Column: username (must exist in dataframe)
|
|
859
|
+
Result: https://example.com/john_doe/profile
|
|
860
|
+
|
|
861
|
+
Template: https://example.com/$region/$city
|
|
862
|
+
Columns: region, city
|
|
863
|
+
Result: https://example.com/north/seattle
|
|
864
|
+
|
|
865
|
+
Template: PC/compound/$1
|
|
866
|
+
Column 1: pubchem_cid
|
|
867
|
+
Result: https://pubchem.ncbi.nlm.nih.gov/compound/12345
|
|
868
|
+
```
|
|
869
|
+
|
|
870
|
+
**Error Handling:**
|
|
871
|
+
|
|
872
|
+
- **Invalid column index**: `$5` when only 3 columns exist → Error message showing valid range
|
|
873
|
+
- **Non-existent column name**: `$invalid_column` → Error message with available columns
|
|
874
|
+
- **No placeholders**: Template treated as constant → All rows get identical URL
|
|
875
|
+
|
|
876
|
+
**Tips:**
|
|
877
|
+
|
|
878
|
+
- Use descriptive column names for `$name` placeholders to make templates self-documenting
|
|
879
|
+
- Test with a small dataset first to verify template correctness
|
|
880
|
+
- Use full undo (`u`) if template produces unexpected URLs
|
|
881
|
+
- For complex multi-column URLs, use column names (`$name`) for clarity over positions (`$1`)
|
|
882
|
+
|
|
716
883
|
## Examples
|
|
717
884
|
|
|
718
885
|
### Single File Examples
|
|
@@ -723,6 +890,30 @@ dv pokemon.csv
|
|
|
723
890
|
|
|
724
891
|
# Chain with other command and specify input file format
|
|
725
892
|
cut -d',' -f1,2,3 pokemon.csv | dv -f csv
|
|
893
|
+
|
|
894
|
+
# Work with gzipped files
|
|
895
|
+
dv large_dataset.csv.gz
|
|
896
|
+
|
|
897
|
+
# CSV file without header row
|
|
898
|
+
dv -H raw_data.csv
|
|
899
|
+
|
|
900
|
+
# Skip type inference for faster loading
|
|
901
|
+
dv -I huge_file.csv
|
|
902
|
+
|
|
903
|
+
# Skip first 5 lines (comments, metadata)
|
|
904
|
+
dv -L 5 data_with_metadata.csv
|
|
905
|
+
|
|
906
|
+
# Skip 1 row after header (units row)
|
|
907
|
+
dv -K 1 data_with_units.csv
|
|
908
|
+
|
|
909
|
+
# Complex CSV with comments and units row
|
|
910
|
+
dv -L 3 -K 1 -I messy_scientific_data.csv
|
|
911
|
+
|
|
912
|
+
# Combine all options: skip lines, skip after header, no header, no inference, gzipped
|
|
913
|
+
dv -L 2 -K 1 -H -I complex_data.csv.gz
|
|
914
|
+
|
|
915
|
+
# Process compressed data from stdin with line skipping
|
|
916
|
+
zcat compressed_data.csv.gz | dv -f csv -L 2
|
|
726
917
|
```
|
|
727
918
|
|
|
728
919
|
### Multi-File/Tab Examples
|
|
@@ -731,8 +922,8 @@ cut -d',' -f1,2,3 pokemon.csv | dv -f csv
|
|
|
731
922
|
# Open multiple sheets as tabs in a single Excel
|
|
732
923
|
dv sales.xlsx
|
|
733
924
|
|
|
734
|
-
# Open multiple files as tabs
|
|
735
|
-
dv pokemon.csv titanic.csv
|
|
925
|
+
# Open multiple files as tabs (including gzipped)
|
|
926
|
+
dv pokemon.csv titanic.csv large_data.csv.gz
|
|
736
927
|
|
|
737
928
|
# Start with one file, then open others using Ctrl+O
|
|
738
929
|
dv initial_data.csv
|