dataframe-textual 2.31.0__tar.gz → 2.34.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-2.31.0 → dataframe_textual-2.34.0}/PKG-INFO +43 -49
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/README.md +40 -46
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/pyproject.toml +3 -3
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/__main__.py +48 -20
- dataframe_textual-2.34.0/src/dataframe_textual/common.py +918 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/data_frame_table.py +241 -97
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/data_frame_viewer.py +22 -21
- dataframe_textual-2.31.0/src/dataframe_textual/file_picker.py → dataframe_textual-2.34.0/src/dataframe_textual/file_picker_screen.py +6 -6
- dataframe_textual-2.34.0/src/dataframe_textual/loading_screen.py +50 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/table_screen.py +31 -23
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/yes_no_screen.py +1 -1
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/uv.lock +16 -16
- dataframe_textual-2.31.0/src/dataframe_textual/common.py → dataframe_textual-2.34.0/xbk/common.py_w_compute_error +15 -13
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/.gitignore +0 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/LICENSE +0 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/main.py +0 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/__init__.py +0 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/data_frame_help_panel.py +0 -0
- {dataframe_textual-2.31.0 → dataframe_textual-2.34.0}/src/dataframe_textual/theme_screen.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dataframe-textual
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.34.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
|
|
@@ -29,9 +29,9 @@ Classifier: Topic :: Utilities
|
|
|
29
29
|
Classifier: Typing :: Typed
|
|
30
30
|
Requires-Python: >=3.11
|
|
31
31
|
Requires-Dist: fastexcel>=0.16.0
|
|
32
|
-
Requires-Dist: polars
|
|
32
|
+
Requires-Dist: polars>1.39.0
|
|
33
33
|
Requires-Dist: textual[syntax]>=8.0.2
|
|
34
|
-
Requires-Dist: vortex-data>=0.
|
|
34
|
+
Requires-Dist: vortex-data>=0.60.0
|
|
35
35
|
Requires-Dist: xlsxwriter>=3.2.9
|
|
36
36
|
Provides-Extra: dev
|
|
37
37
|
Requires-Dist: textual-dev>=1.8.0; extra == 'dev'
|
|
@@ -46,7 +46,7 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/[Parquet]
|
|
|
46
46
|
## Features
|
|
47
47
|
|
|
48
48
|
### Data Viewing
|
|
49
|
-
- 🚀 **Fast Loading** - Powered by Polars for efficient data handling
|
|
49
|
+
- 🚀 **Fast Loading** - Powered by Polars for efficient batch data handling
|
|
50
50
|
- 🎨 **Rich Terminal UI** - Beautiful, color-coded columns with various data types (e.g., integer, float, string)
|
|
51
51
|
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
52
52
|
- 📊 **Flexible Input** - Read from files and/or stdin (pipes/redirects)
|
|
@@ -78,26 +78,15 @@ pip install dataframe-textual
|
|
|
78
78
|
|
|
79
79
|
This installs an executable `dv`.
|
|
80
80
|
|
|
81
|
-
Then run:
|
|
82
|
-
```bash
|
|
83
|
-
dv <file>
|
|
84
|
-
```
|
|
85
81
|
|
|
86
82
|
### Using [uv](https://docs.astral.sh/uv/)
|
|
87
83
|
|
|
88
84
|
```bash
|
|
89
85
|
# Install as a tool
|
|
90
|
-
uv install dataframe-textual
|
|
86
|
+
uv tool install dataframe-textual
|
|
91
87
|
|
|
92
88
|
# Quick run using uvx without installation
|
|
93
89
|
uvx https://github.com/need47/dataframe-textual.git <csvfile>
|
|
94
|
-
|
|
95
|
-
# Clone or download the project
|
|
96
|
-
cd dataframe-textual
|
|
97
|
-
uv sync
|
|
98
|
-
|
|
99
|
-
# Run directly with uv
|
|
100
|
-
uv run dv <file>
|
|
101
90
|
```
|
|
102
91
|
|
|
103
92
|
### Development installation
|
|
@@ -107,10 +96,7 @@ uv run dv <file>
|
|
|
107
96
|
git clone https://github.com/need47/dataframe-textual.git
|
|
108
97
|
cd dataframe-textual
|
|
109
98
|
|
|
110
|
-
# Install from local source
|
|
111
|
-
pip install -e .
|
|
112
|
-
|
|
113
|
-
# With development dependencies
|
|
99
|
+
# Install from local source with development dependencies
|
|
114
100
|
pip install -e ".[dev]"
|
|
115
101
|
```
|
|
116
102
|
|
|
@@ -122,12 +108,6 @@ pip install -e ".[dev]"
|
|
|
122
108
|
# After pip install dataframe-textual
|
|
123
109
|
dv pokemon.csv
|
|
124
110
|
|
|
125
|
-
# Or run from module
|
|
126
|
-
python -m dataframe-textual pokemon.csv
|
|
127
|
-
|
|
128
|
-
# Or with uv
|
|
129
|
-
uv run python main.py pokemon.csv
|
|
130
|
-
|
|
131
111
|
# Read from stdin (defaults to TSV)
|
|
132
112
|
cat data.tsv | dv
|
|
133
113
|
dv < data.tsv
|
|
@@ -152,11 +132,19 @@ dv file.xlsx
|
|
|
152
132
|
dv data1.tsv < data2.tsv
|
|
153
133
|
```
|
|
154
134
|
|
|
135
|
+
### Multi-File Usage - Single Tab
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
|
|
139
|
+
# Read all parquet files (must be of same format and same structure) into one single table
|
|
140
|
+
dv *.parquet --all-in-one
|
|
141
|
+
```
|
|
142
|
+
|
|
155
143
|
When multiple files are opened:
|
|
156
144
|
- Each file appears as a separate tab. An Excel file may contain multiple tabs.
|
|
157
145
|
- Move the current tab with `>` (right, wrap to first) or `<` (left, wrap to last); use `b` to cycle tabs
|
|
158
146
|
- Save current tab to file with `Ctrl+T`
|
|
159
|
-
- Save all tabs to file with `Ctrl+
|
|
147
|
+
- Save all tabs to file with `Ctrl+S`
|
|
160
148
|
- Duplicate the current tab with `Ctrl+D`
|
|
161
149
|
- Open additional files with `Ctrl+O`
|
|
162
150
|
- Each file maintains its own state (edits, sort order, selections, history, etc.) and allow undo/redo.
|
|
@@ -164,10 +152,10 @@ When multiple files are opened:
|
|
|
164
152
|
## Command Line Options
|
|
165
153
|
|
|
166
154
|
```
|
|
167
|
-
usage: dv [-h] [-V] [-d DELIMITER] [-
|
|
155
|
+
usage: dv [-h] [-V] [-d DELIMITER] [-f [FIELDS ...]] [-H [HEADER ...]] [-L N] [-I] [-T] [-E] [-C [PREFIX]] [-Q [C]] [-K N] [-A N] [-M N] [-N NULL [NULL ...]] [--theme [THEME]] [--all-in-one] [--sql SQL]
|
|
168
156
|
[files ...]
|
|
169
157
|
|
|
170
|
-
|
|
158
|
+
TUI viewer/editor for tabular data (e.g., CSV/Excel).
|
|
171
159
|
|
|
172
160
|
positional arguments:
|
|
173
161
|
files Files to view (or read from stdin)
|
|
@@ -176,17 +164,19 @@ options:
|
|
|
176
164
|
-h, --help show this help message and exit
|
|
177
165
|
-V, --version show program's version number and exit
|
|
178
166
|
-d, --delimiter DELIMITER
|
|
179
|
-
Specify the delimiter of the input files (must be a single character, e.g.,
|
|
167
|
+
Specify the delimiter of the input files (must be a single character, e.g., `|` or `;`)
|
|
180
168
|
-f, --fields [FIELDS ...]
|
|
181
169
|
When used without values, list available fields. Otherwise, read only specified fields.
|
|
182
170
|
-H, --header [HEADER ...]
|
|
183
|
-
Specify header info.
|
|
171
|
+
Specify header info. When reading CSV/TSV. If used without values, assumes no header. Otherwise, use provided values as column header (e.g., `-H col1 col2 col3`).
|
|
172
|
+
-L, --infer_schema_length N
|
|
173
|
+
Number of rows to use for inferring schema when reading CSV/TSV. Defaults to 100. When used without value, uses all rows for schema inference (can be slow for large files).
|
|
184
174
|
-I, --no-inference Do not infer data types when reading CSV/TSV
|
|
185
175
|
-T, --truncate-ragged-lines
|
|
186
176
|
Truncate ragged lines when reading CSV/TSV
|
|
187
177
|
-E, --ignore-errors Ignore errors when reading CSV/TSV
|
|
188
178
|
-C, --comment-prefix [PREFIX]
|
|
189
|
-
|
|
179
|
+
Skip comment lines starting with `PREFIX` when reading CSV/TSV
|
|
190
180
|
-Q, --quote-char [C] Use `C` as quote character for reading CSV/TSV. When used without value, disables special handling of quote characters.
|
|
191
181
|
-K, --skip-lines N Skip first N lines when reading CSV/TSV
|
|
192
182
|
-A, --skip-rows-after-header N
|
|
@@ -194,9 +184,9 @@ options:
|
|
|
194
184
|
-M, --n-rows N Read maximum rows
|
|
195
185
|
-N, --null NULL [NULL ...]
|
|
196
186
|
Values to interpret as null values when reading CSV/TSV
|
|
197
|
-
--sql SQL Specify a SQL query to execute on the input file (e.g., to select and filter data)
|
|
198
187
|
--theme [THEME] Set the theme for the application. If used without value, show available themes.
|
|
199
|
-
--all-in-one, --aio Read all files (must be of
|
|
188
|
+
--all-in-one, --aio Read all files (must be of same format and same structure) into one single table.
|
|
189
|
+
--sql SQL Specify a SQL query to execute on the input file (e.g., to select and filter data)
|
|
200
190
|
```
|
|
201
191
|
|
|
202
192
|
### CLI Examples
|
|
@@ -235,7 +225,7 @@ dv large_data.csv -I
|
|
|
235
225
|
# Ignore parsing errors in malformed CSV
|
|
236
226
|
dv data_with_errors.csv -E
|
|
237
227
|
|
|
238
|
-
# Treat specific values as null/missing (e.g., 'NA', 'N/A'
|
|
228
|
+
# Treat specific values as null/missing (e.g., 'NA', 'N/A')
|
|
239
229
|
dv data.csv -N NA N/A
|
|
240
230
|
|
|
241
231
|
# Use different quote character (e.g., single quote for CSV)
|
|
@@ -248,16 +238,16 @@ dv data.tsv -Q
|
|
|
248
238
|
dv data.csv --theme monokai
|
|
249
239
|
|
|
250
240
|
# Show column headers
|
|
251
|
-
dv data.csv -
|
|
241
|
+
dv data.csv -f
|
|
252
242
|
|
|
253
243
|
# Read only specific columns: 'name', 'age', first column, and last column
|
|
254
|
-
dv data.csv -
|
|
244
|
+
dv data.csv -f name age 1 -1
|
|
245
|
+
|
|
246
|
+
# Read all files (must be of same format and same structure) into one single table
|
|
247
|
+
dv data-1.csv data-2.csv --all-in-one
|
|
255
248
|
|
|
256
249
|
# Filter data using SQL query (use 'self' as the table name)
|
|
257
250
|
dv data.csv --sql 'SELECT * FROM self WHERE age > 30'
|
|
258
|
-
|
|
259
|
-
# Read all files (must be of the same structure) into a single table
|
|
260
|
-
dv data-1.csv data-2.csv --all-in-one
|
|
261
251
|
```
|
|
262
252
|
|
|
263
253
|
## Keyboard Shortcuts
|
|
@@ -268,12 +258,13 @@ dv data-1.csv data-2.csv --all-in-one
|
|
|
268
258
|
|
|
269
259
|
| Key | Action |
|
|
270
260
|
| -------------- | ------------------------------------------------------------- |
|
|
271
|
-
| `>` | Move current tab right (wrap to first) |
|
|
272
|
-
| `<` | Move current tab left (wrap to last) |
|
|
273
|
-
| `b` | Cycle through tabs |
|
|
274
|
-
| `B` | Toggle tab bar visibility |
|
|
275
261
|
| `q` | Close current tab (prompts to save unsaved changes) |
|
|
276
262
|
| `Q` | Close all tabs and quit app (prompts to save unsaved changes) |
|
|
263
|
+
| `space` | Toggle tab bar visibility |
|
|
264
|
+
| `b` | Next tab |
|
|
265
|
+
| `B` | Previous tab |
|
|
266
|
+
| `>` | Move current tab right (wrap to first) |
|
|
267
|
+
| `<` | Move current tab left (wrap to last) |
|
|
277
268
|
| `Ctrl+Q` | Force to quit app (regardless of unsaved changes) |
|
|
278
269
|
| `Ctrl+V` | Save current view to file |
|
|
279
270
|
| `Ctrl+T` | Save current tab to file |
|
|
@@ -286,11 +277,11 @@ dv data-1.csv data-2.csv --all-in-one
|
|
|
286
277
|
|
|
287
278
|
#### View & Settings
|
|
288
279
|
|
|
289
|
-
| Key | Action
|
|
290
|
-
| ------------------------ |
|
|
291
|
-
| `F1` | Toggle help panel
|
|
292
|
-
| `k` | Select theme
|
|
293
|
-
| `Ctrl+P` -> `Screenshot` | Capture terminal view as a SVG image
|
|
280
|
+
| Key | Action |
|
|
281
|
+
| ------------------------ | ------------------------------------ |
|
|
282
|
+
| `F1` | Toggle help panel |
|
|
283
|
+
| `k` | Select theme |
|
|
284
|
+
| `Ctrl+P` -> `Screenshot` | Capture terminal view as a SVG image |
|
|
294
285
|
|
|
295
286
|
---
|
|
296
287
|
|
|
@@ -629,6 +620,9 @@ Press `F` to see value distributions of the current column. The modal shows:
|
|
|
629
620
|
- Press `[` and `]` to sort by any column (value, count, or percentage)
|
|
630
621
|
- Press `v` to **view** all rows containing the selected value
|
|
631
622
|
- Press `"` to **filter** all rows containing the selected value to a new tab
|
|
623
|
+
- Press `,` to toggle thousand separator
|
|
624
|
+
- Press `g` to scroll to top
|
|
625
|
+
- Press `G` to scroll to bottom
|
|
632
626
|
- Press `Ctrl+S` to save the frequency table to file
|
|
633
627
|
- Press `q` or `Escape` to close the frequency table
|
|
634
628
|
|
|
@@ -7,7 +7,7 @@ A powerful, interactive terminal-based viewer/editor for CSV/TSV/Excel/[Parquet]
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
### Data Viewing
|
|
10
|
-
- 🚀 **Fast Loading** - Powered by Polars for efficient data handling
|
|
10
|
+
- 🚀 **Fast Loading** - Powered by Polars for efficient batch data handling
|
|
11
11
|
- 🎨 **Rich Terminal UI** - Beautiful, color-coded columns with various data types (e.g., integer, float, string)
|
|
12
12
|
- ⌨️ **Comprehensive Keyboard Navigation** - Intuitive controls
|
|
13
13
|
- 📊 **Flexible Input** - Read from files and/or stdin (pipes/redirects)
|
|
@@ -39,26 +39,15 @@ pip install dataframe-textual
|
|
|
39
39
|
|
|
40
40
|
This installs an executable `dv`.
|
|
41
41
|
|
|
42
|
-
Then run:
|
|
43
|
-
```bash
|
|
44
|
-
dv <file>
|
|
45
|
-
```
|
|
46
42
|
|
|
47
43
|
### Using [uv](https://docs.astral.sh/uv/)
|
|
48
44
|
|
|
49
45
|
```bash
|
|
50
46
|
# Install as a tool
|
|
51
|
-
uv install dataframe-textual
|
|
47
|
+
uv tool install dataframe-textual
|
|
52
48
|
|
|
53
49
|
# Quick run using uvx without installation
|
|
54
50
|
uvx https://github.com/need47/dataframe-textual.git <csvfile>
|
|
55
|
-
|
|
56
|
-
# Clone or download the project
|
|
57
|
-
cd dataframe-textual
|
|
58
|
-
uv sync
|
|
59
|
-
|
|
60
|
-
# Run directly with uv
|
|
61
|
-
uv run dv <file>
|
|
62
51
|
```
|
|
63
52
|
|
|
64
53
|
### Development installation
|
|
@@ -68,10 +57,7 @@ uv run dv <file>
|
|
|
68
57
|
git clone https://github.com/need47/dataframe-textual.git
|
|
69
58
|
cd dataframe-textual
|
|
70
59
|
|
|
71
|
-
# Install from local source
|
|
72
|
-
pip install -e .
|
|
73
|
-
|
|
74
|
-
# With development dependencies
|
|
60
|
+
# Install from local source with development dependencies
|
|
75
61
|
pip install -e ".[dev]"
|
|
76
62
|
```
|
|
77
63
|
|
|
@@ -83,12 +69,6 @@ pip install -e ".[dev]"
|
|
|
83
69
|
# After pip install dataframe-textual
|
|
84
70
|
dv pokemon.csv
|
|
85
71
|
|
|
86
|
-
# Or run from module
|
|
87
|
-
python -m dataframe-textual pokemon.csv
|
|
88
|
-
|
|
89
|
-
# Or with uv
|
|
90
|
-
uv run python main.py pokemon.csv
|
|
91
|
-
|
|
92
72
|
# Read from stdin (defaults to TSV)
|
|
93
73
|
cat data.tsv | dv
|
|
94
74
|
dv < data.tsv
|
|
@@ -113,11 +93,19 @@ dv file.xlsx
|
|
|
113
93
|
dv data1.tsv < data2.tsv
|
|
114
94
|
```
|
|
115
95
|
|
|
96
|
+
### Multi-File Usage - Single Tab
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
|
|
100
|
+
# Read all parquet files (must be of same format and same structure) into one single table
|
|
101
|
+
dv *.parquet --all-in-one
|
|
102
|
+
```
|
|
103
|
+
|
|
116
104
|
When multiple files are opened:
|
|
117
105
|
- Each file appears as a separate tab. An Excel file may contain multiple tabs.
|
|
118
106
|
- Move the current tab with `>` (right, wrap to first) or `<` (left, wrap to last); use `b` to cycle tabs
|
|
119
107
|
- Save current tab to file with `Ctrl+T`
|
|
120
|
-
- Save all tabs to file with `Ctrl+
|
|
108
|
+
- Save all tabs to file with `Ctrl+S`
|
|
121
109
|
- Duplicate the current tab with `Ctrl+D`
|
|
122
110
|
- Open additional files with `Ctrl+O`
|
|
123
111
|
- Each file maintains its own state (edits, sort order, selections, history, etc.) and allow undo/redo.
|
|
@@ -125,10 +113,10 @@ When multiple files are opened:
|
|
|
125
113
|
## Command Line Options
|
|
126
114
|
|
|
127
115
|
```
|
|
128
|
-
usage: dv [-h] [-V] [-d DELIMITER] [-
|
|
116
|
+
usage: dv [-h] [-V] [-d DELIMITER] [-f [FIELDS ...]] [-H [HEADER ...]] [-L N] [-I] [-T] [-E] [-C [PREFIX]] [-Q [C]] [-K N] [-A N] [-M N] [-N NULL [NULL ...]] [--theme [THEME]] [--all-in-one] [--sql SQL]
|
|
129
117
|
[files ...]
|
|
130
118
|
|
|
131
|
-
|
|
119
|
+
TUI viewer/editor for tabular data (e.g., CSV/Excel).
|
|
132
120
|
|
|
133
121
|
positional arguments:
|
|
134
122
|
files Files to view (or read from stdin)
|
|
@@ -137,17 +125,19 @@ options:
|
|
|
137
125
|
-h, --help show this help message and exit
|
|
138
126
|
-V, --version show program's version number and exit
|
|
139
127
|
-d, --delimiter DELIMITER
|
|
140
|
-
Specify the delimiter of the input files (must be a single character, e.g.,
|
|
128
|
+
Specify the delimiter of the input files (must be a single character, e.g., `|` or `;`)
|
|
141
129
|
-f, --fields [FIELDS ...]
|
|
142
130
|
When used without values, list available fields. Otherwise, read only specified fields.
|
|
143
131
|
-H, --header [HEADER ...]
|
|
144
|
-
Specify header info.
|
|
132
|
+
Specify header info. When reading CSV/TSV. If used without values, assumes no header. Otherwise, use provided values as column header (e.g., `-H col1 col2 col3`).
|
|
133
|
+
-L, --infer_schema_length N
|
|
134
|
+
Number of rows to use for inferring schema when reading CSV/TSV. Defaults to 100. When used without value, uses all rows for schema inference (can be slow for large files).
|
|
145
135
|
-I, --no-inference Do not infer data types when reading CSV/TSV
|
|
146
136
|
-T, --truncate-ragged-lines
|
|
147
137
|
Truncate ragged lines when reading CSV/TSV
|
|
148
138
|
-E, --ignore-errors Ignore errors when reading CSV/TSV
|
|
149
139
|
-C, --comment-prefix [PREFIX]
|
|
150
|
-
|
|
140
|
+
Skip comment lines starting with `PREFIX` when reading CSV/TSV
|
|
151
141
|
-Q, --quote-char [C] Use `C` as quote character for reading CSV/TSV. When used without value, disables special handling of quote characters.
|
|
152
142
|
-K, --skip-lines N Skip first N lines when reading CSV/TSV
|
|
153
143
|
-A, --skip-rows-after-header N
|
|
@@ -155,9 +145,9 @@ options:
|
|
|
155
145
|
-M, --n-rows N Read maximum rows
|
|
156
146
|
-N, --null NULL [NULL ...]
|
|
157
147
|
Values to interpret as null values when reading CSV/TSV
|
|
158
|
-
--sql SQL Specify a SQL query to execute on the input file (e.g., to select and filter data)
|
|
159
148
|
--theme [THEME] Set the theme for the application. If used without value, show available themes.
|
|
160
|
-
--all-in-one, --aio Read all files (must be of
|
|
149
|
+
--all-in-one, --aio Read all files (must be of same format and same structure) into one single table.
|
|
150
|
+
--sql SQL Specify a SQL query to execute on the input file (e.g., to select and filter data)
|
|
161
151
|
```
|
|
162
152
|
|
|
163
153
|
### CLI Examples
|
|
@@ -196,7 +186,7 @@ dv large_data.csv -I
|
|
|
196
186
|
# Ignore parsing errors in malformed CSV
|
|
197
187
|
dv data_with_errors.csv -E
|
|
198
188
|
|
|
199
|
-
# Treat specific values as null/missing (e.g., 'NA', 'N/A'
|
|
189
|
+
# Treat specific values as null/missing (e.g., 'NA', 'N/A')
|
|
200
190
|
dv data.csv -N NA N/A
|
|
201
191
|
|
|
202
192
|
# Use different quote character (e.g., single quote for CSV)
|
|
@@ -209,16 +199,16 @@ dv data.tsv -Q
|
|
|
209
199
|
dv data.csv --theme monokai
|
|
210
200
|
|
|
211
201
|
# Show column headers
|
|
212
|
-
dv data.csv -
|
|
202
|
+
dv data.csv -f
|
|
213
203
|
|
|
214
204
|
# Read only specific columns: 'name', 'age', first column, and last column
|
|
215
|
-
dv data.csv -
|
|
205
|
+
dv data.csv -f name age 1 -1
|
|
206
|
+
|
|
207
|
+
# Read all files (must be of same format and same structure) into one single table
|
|
208
|
+
dv data-1.csv data-2.csv --all-in-one
|
|
216
209
|
|
|
217
210
|
# Filter data using SQL query (use 'self' as the table name)
|
|
218
211
|
dv data.csv --sql 'SELECT * FROM self WHERE age > 30'
|
|
219
|
-
|
|
220
|
-
# Read all files (must be of the same structure) into a single table
|
|
221
|
-
dv data-1.csv data-2.csv --all-in-one
|
|
222
212
|
```
|
|
223
213
|
|
|
224
214
|
## Keyboard Shortcuts
|
|
@@ -229,12 +219,13 @@ dv data-1.csv data-2.csv --all-in-one
|
|
|
229
219
|
|
|
230
220
|
| Key | Action |
|
|
231
221
|
| -------------- | ------------------------------------------------------------- |
|
|
232
|
-
| `>` | Move current tab right (wrap to first) |
|
|
233
|
-
| `<` | Move current tab left (wrap to last) |
|
|
234
|
-
| `b` | Cycle through tabs |
|
|
235
|
-
| `B` | Toggle tab bar visibility |
|
|
236
222
|
| `q` | Close current tab (prompts to save unsaved changes) |
|
|
237
223
|
| `Q` | Close all tabs and quit app (prompts to save unsaved changes) |
|
|
224
|
+
| `space` | Toggle tab bar visibility |
|
|
225
|
+
| `b` | Next tab |
|
|
226
|
+
| `B` | Previous tab |
|
|
227
|
+
| `>` | Move current tab right (wrap to first) |
|
|
228
|
+
| `<` | Move current tab left (wrap to last) |
|
|
238
229
|
| `Ctrl+Q` | Force to quit app (regardless of unsaved changes) |
|
|
239
230
|
| `Ctrl+V` | Save current view to file |
|
|
240
231
|
| `Ctrl+T` | Save current tab to file |
|
|
@@ -247,11 +238,11 @@ dv data-1.csv data-2.csv --all-in-one
|
|
|
247
238
|
|
|
248
239
|
#### View & Settings
|
|
249
240
|
|
|
250
|
-
| Key | Action
|
|
251
|
-
| ------------------------ |
|
|
252
|
-
| `F1` | Toggle help panel
|
|
253
|
-
| `k` | Select theme
|
|
254
|
-
| `Ctrl+P` -> `Screenshot` | Capture terminal view as a SVG image
|
|
241
|
+
| Key | Action |
|
|
242
|
+
| ------------------------ | ------------------------------------ |
|
|
243
|
+
| `F1` | Toggle help panel |
|
|
244
|
+
| `k` | Select theme |
|
|
245
|
+
| `Ctrl+P` -> `Screenshot` | Capture terminal view as a SVG image |
|
|
255
246
|
|
|
256
247
|
---
|
|
257
248
|
|
|
@@ -590,6 +581,9 @@ Press `F` to see value distributions of the current column. The modal shows:
|
|
|
590
581
|
- Press `[` and `]` to sort by any column (value, count, or percentage)
|
|
591
582
|
- Press `v` to **view** all rows containing the selected value
|
|
592
583
|
- Press `"` to **filter** all rows containing the selected value to a new tab
|
|
584
|
+
- Press `,` to toggle thousand separator
|
|
585
|
+
- Press `g` to scroll to top
|
|
586
|
+
- Press `G` to scroll to bottom
|
|
593
587
|
- Press `Ctrl+S` to save the frequency table to file
|
|
594
588
|
- Press `q` or `Escape` to close the frequency table
|
|
595
589
|
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "dataframe-textual"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.34.0"
|
|
8
8
|
description = "Interactive terminal viewer/editor for tabular data"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -33,11 +33,11 @@ classifiers = [
|
|
|
33
33
|
"Typing :: Typed",
|
|
34
34
|
]
|
|
35
35
|
dependencies = [
|
|
36
|
-
"polars
|
|
36
|
+
"polars>1.39.0",
|
|
37
37
|
"fastexcel>=0.16.0",
|
|
38
38
|
"xlsxwriter>=3.2.9",
|
|
39
39
|
"textual[syntax]>=8.0.2",
|
|
40
|
-
"vortex-data>=0.
|
|
40
|
+
"vortex-data>=0.60.0",
|
|
41
41
|
]
|
|
42
42
|
|
|
43
43
|
[project.urls]
|
|
@@ -8,7 +8,7 @@ import polars as pl
|
|
|
8
8
|
from textual.theme import BUILTIN_THEMES
|
|
9
9
|
|
|
10
10
|
from . import __version__
|
|
11
|
-
from .common import load_dataframe
|
|
11
|
+
from .common import handle_compute_error, load_dataframe
|
|
12
12
|
from .data_frame_viewer import DataFrameViewer
|
|
13
13
|
|
|
14
14
|
|
|
@@ -49,11 +49,11 @@ def cli() -> argparse.Namespace:
|
|
|
49
49
|
"""
|
|
50
50
|
parser = argparse.ArgumentParser(
|
|
51
51
|
prog="dv",
|
|
52
|
-
description="
|
|
52
|
+
description="TUI viewer/editor for tabular data (e.g., CSV/Excel).",
|
|
53
53
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
54
54
|
epilog="Examples:\n"
|
|
55
55
|
" %(prog)s data.csv\n"
|
|
56
|
-
" %(prog)s file1.csv file2.
|
|
56
|
+
" %(prog)s file1.csv.gz file2.tsv file3.csv\n"
|
|
57
57
|
" %(prog)s data.xlsx (opens each sheet in separate tab)\n"
|
|
58
58
|
" cat data.txt | %(prog)s -d ';'\n",
|
|
59
59
|
)
|
|
@@ -67,7 +67,7 @@ def cli() -> argparse.Namespace:
|
|
|
67
67
|
parser.add_argument(
|
|
68
68
|
"-d",
|
|
69
69
|
"--delimiter",
|
|
70
|
-
help="Specify the delimiter of the input files (must be a single character, e.g.,
|
|
70
|
+
help="Specify the delimiter of the input files (must be a single character, e.g., `|` or `;`)",
|
|
71
71
|
)
|
|
72
72
|
parser.add_argument(
|
|
73
73
|
"-f",
|
|
@@ -83,7 +83,17 @@ def cli() -> argparse.Namespace:
|
|
|
83
83
|
nargs="*",
|
|
84
84
|
action=ConstWithMultiArgs,
|
|
85
85
|
const=False,
|
|
86
|
-
help="Specify header info.
|
|
86
|
+
help="Specify header info. When reading CSV/TSV. If used without values, assumes no header. Otherwise, use provided values as column header (e.g., `-H col1 col2 col3`).",
|
|
87
|
+
)
|
|
88
|
+
parser.add_argument(
|
|
89
|
+
"-L",
|
|
90
|
+
"--infer_schema_length",
|
|
91
|
+
nargs="?",
|
|
92
|
+
metavar="N",
|
|
93
|
+
type=int,
|
|
94
|
+
default=100,
|
|
95
|
+
const=None,
|
|
96
|
+
help="Number of rows to use for inferring schema when reading CSV/TSV. Defaults to 100. When used without value, uses all rows for schema inference (can be slow for large files).",
|
|
87
97
|
)
|
|
88
98
|
parser.add_argument(
|
|
89
99
|
"-I", "--no-inference", action="store_true", help="Do not infer data types when reading CSV/TSV"
|
|
@@ -121,11 +131,14 @@ def cli() -> argparse.Namespace:
|
|
|
121
131
|
help="Skip N rows after header when reading CSV/TSV",
|
|
122
132
|
)
|
|
123
133
|
parser.add_argument("-M", "--n-rows", metavar="N", type=int, help="Read maximum rows")
|
|
124
|
-
parser.add_argument("-N", "--null", nargs="+", help="Values to interpret as null values when reading CSV/TSV")
|
|
125
|
-
|
|
126
134
|
parser.add_argument(
|
|
127
|
-
"
|
|
135
|
+
"-N",
|
|
136
|
+
"--null",
|
|
137
|
+
nargs="+",
|
|
138
|
+
default=["IsNULL", "NULL"],
|
|
139
|
+
help="Values to interpret as null values when reading CSV/TSV",
|
|
128
140
|
)
|
|
141
|
+
|
|
129
142
|
parser.add_argument(
|
|
130
143
|
"--theme",
|
|
131
144
|
nargs="?",
|
|
@@ -138,7 +151,11 @@ def cli() -> argparse.Namespace:
|
|
|
138
151
|
"--all-in-one",
|
|
139
152
|
"--aio",
|
|
140
153
|
action="store_true",
|
|
141
|
-
help="Read all files (must be of
|
|
154
|
+
help="Read all files (must be of same format and same structure) into one single table.",
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
parser.add_argument(
|
|
158
|
+
"--sql", help="Specify a SQL query to execute on the input file (e.g., to select and filter data)"
|
|
142
159
|
)
|
|
143
160
|
|
|
144
161
|
args = parser.parse_args()
|
|
@@ -162,14 +179,24 @@ def cli() -> argparse.Namespace:
|
|
|
162
179
|
args.files = []
|
|
163
180
|
|
|
164
181
|
# Check if reading from stdin (pipe or redirect)
|
|
165
|
-
if not sys.stdin.isatty():
|
|
182
|
+
if not sys.stdin.isatty() and "-" not in args.files:
|
|
166
183
|
args.files.append("-")
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
184
|
+
|
|
185
|
+
# Validate all files
|
|
186
|
+
for filename in args.files:
|
|
187
|
+
if filename == "-":
|
|
188
|
+
continue # stdin will be handled separately
|
|
189
|
+
|
|
190
|
+
filepath = Path(filename)
|
|
191
|
+
if not filepath.exists():
|
|
192
|
+
print(f"File not found: `{filename}`", file=sys.stderr)
|
|
193
|
+
sys.exit(1)
|
|
194
|
+
elif not filepath.is_file():
|
|
195
|
+
print(f"Not a file: `{filename}`", file=sys.stderr)
|
|
196
|
+
sys.exit(1)
|
|
197
|
+
elif filepath.stat().st_size == 0:
|
|
198
|
+
print(f"File is empty: `{filename}`", file=sys.stderr)
|
|
199
|
+
sys.exit(1)
|
|
173
200
|
|
|
174
201
|
if not args.files:
|
|
175
202
|
parser.print_help()
|
|
@@ -186,6 +213,7 @@ def main() -> None:
|
|
|
186
213
|
delimiter=args.delimiter,
|
|
187
214
|
header=args.header,
|
|
188
215
|
infer_schema=not args.no_inference,
|
|
216
|
+
infer_schema_length=args.infer_schema_length,
|
|
189
217
|
comment_prefix=args.comment_prefix,
|
|
190
218
|
quote_char=args.quote_char,
|
|
191
219
|
skip_lines=args.skip_lines,
|
|
@@ -201,7 +229,7 @@ def main() -> None:
|
|
|
201
229
|
# List available fields and exit
|
|
202
230
|
if args.fields == "list":
|
|
203
231
|
for source in sources:
|
|
204
|
-
for idx, field in enumerate(source.
|
|
232
|
+
for idx, field in enumerate(source.lf.collect_schema().names()):
|
|
205
233
|
print(idx + 1, field, sep="\t")
|
|
206
234
|
break # Only list fields for the first source
|
|
207
235
|
|
|
@@ -209,16 +237,16 @@ def main() -> None:
|
|
|
209
237
|
|
|
210
238
|
if args.sql:
|
|
211
239
|
for source in sources:
|
|
212
|
-
ctx = pl.SQLContext(frames={"self": source.
|
|
240
|
+
ctx = pl.SQLContext(frames={"self": source.lf})
|
|
213
241
|
try:
|
|
214
|
-
source.
|
|
242
|
+
source.lf = ctx.execute(args.sql)
|
|
215
243
|
except pl.exceptions.SQLInterfaceError as e:
|
|
216
244
|
print(f"SQL error: {e}", file=sys.stderr)
|
|
217
245
|
sys.exit(1)
|
|
218
246
|
|
|
219
247
|
# Run the DataFrame Viewer application
|
|
220
248
|
app = DataFrameViewer(*sources, theme=args.theme)
|
|
221
|
-
app.run()
|
|
249
|
+
handle_compute_error(app.run())
|
|
222
250
|
|
|
223
251
|
|
|
224
252
|
if __name__ == "__main__":
|