A terminal spreadsheet multitool for discovering and arranging data
This release may be a small one, but it contains a handful of meaningful bugfixes that we wanted to get out the door.
Happy New Year, everyone!
- [macros] allow macro interfaces to be longnames (thanks @frosencrantz #787)
- [save] better default save filename for url sheets (thanks @geekscrapy #824)
- [cmdlog] record column, sheet, and row info for open-cell
- [cmdlog] catch case of 'override' sheet for set-option
- [expr-col] `curcol` now works for multiple invocations (thanks @geekscrapy #659)
- [loaders postgres] account for postgres_schema when rendering Postgres tables (thanks @jdormit for PR #852)
- [loaders url] fail unknown URL scheme (thanks @geekscrapy for PR #84)
- [pyobj] fix Pyobj Sheets for lists (thanks @brookskindle #843)
- [pipe] handle broken pipes gracefully (thanks @robdmc #851)
- [scroll] fix issue with jagged scrolling down (thanks @uoee #832)
- [sort] fix bug where total progress in sorting is (100 * # of columns to sort) (thanks @cwarden)
This release fixes several bugs in 2.0 and fills in some of the gaps. Please see the CHANGELOG for the complete list of changes and bugfixes.
options.some_selected_rows
Some commands, like setcol-expr
(g=
) operate on the selected rows. Before 2.0, if no rows were selected, these commands would fall back to operating over all rows. This is intuitive and helpful, but can cause problems with non-interactive script replay: sometimes there are legitimately no selected rows, and so the command should not do anything (but also not fail).
So the behavior was changed in 2.0 to have reliable and deterministic results. It's reasonably easy to work around: select all rows with gs
, repeat the command, and maybe unselect them all with gu
. But this turned out to be ultimately disappointing for interactive use.
So, in 2.1, there is now an option some_selected_rows
, which if True, causes these commands to operate on all rows, if none are selected:
setcol-expr
(g=
)setcol-iter
(gz=
)setcol-subst
(g*
)setcol-subst-all
(gz*
)This option applies only to interactive mode, and not to batch mode. In batch mode, commands that operate on selected rows will always use the list of selected rows, even if there are none (and so it won't do anything). Be careful about saving .vd scripts from sessions in which this option was set; the results when replaying in batch mode may not be as expected.
options.numeric_binning
For 2.0, ranged binning of numeric columns was implemented, and allowed to be disabled by setting options.numeric_binning
to False.
(By default it was set to True.)
In 2.1, this option is now disabled by default, and must be enabled (whether globally or per-sheet) by setting it to True.
edit-cell
to move cursor and re-enter edit modeBy popular demand, pressing Shift+Arrow when editing a cell, will save the current value, move the cursor one row or column in the given direction, and re-enter edit mode. This makes it easier to enter data, either row-wise or column-wise.
This feature obsoletes options.cmd_after_edit
, which was always a terrible hack. It has no effect now.
In 2.0, expressions could use attributes on the vd
singleton or the current sheet
object, and had sheet
and row
special variables to refer to the sheet and row objects themselves.
In 2.1, expressions can also use attributes of the expression column, and col
can be used to refer to the column object directly. (So col.width
and width
both refer to the width of the expression column itself, if there are no columns named width
.)
select-equal-
and select-exact-
.Previously, select-equal-
(bound to ,
) matched on the typed value. Now, select-equal-
matches on the displayed value. New commands select-exact-cell
/-row
that match on typed value are bound to z,
and gz,
(the display value may be rounded or formatted with less precision, so using the typed value is "more precise".
(Thanks @geekscrapy for noticing)
A new command macro-record
(bound to m
) starts recording commands for use in a macro. The same command stops recording and prompts for a keystroke to bind the macro to. When the given keystroke is pressed, the macro will be executed. All macros run their commands on the current (row, column, sheet), regardless of the cursor position when the macro was recorded.
The new command macro-sheet
(bound to gm
) opens an index of all current macros. A macro on this sheet can be viewed with Enter
and then modified, saving changes with Ctrl+S
This feature obsoletes the older iteration of macro system, and removes the deprecated z Ctrl+D
command.
(Thanks @bob-u for the suggestion)
mode
and stdev
aggregators.d
on options sheet (also add options.unset()
API function)..vdj
scripts are now hashbangable. Put #!vd -p
at the start of the .vdj file and watch it go! (Note: extension must still be .vdj for now.)floatsi
type (z%
) can now parse SI strings like "2.3M" (thanks @anjakefala for sponsoring).;
) will use capture names as column names, if available (thanks @tsibley).[http] auto-paginate by continuing with the given links.next.url
from the response.
[json] 50% speedup for loading (thanks @lxcode).
[pdf] options.pdf_tables
to parse tables from pdf with tabular
.
[sqlite] Use internal rowid to update and delete rows (WITHOUT ROWID
sqlite tables can no longer be modified).
[zip] Add extract-file
, extract-selected
, extract-file-to
, extract-selected-to
commands (bound to x
, gx
, zx
, and gzx
on the ZipSheet).
[fixed] Add fixed-width saver (uses col.width).
[clickhouse] Add plugin for clickhouse loader.
i
family of commands (iota/increment)zM
, which does row-wise expansion of iterables in a columnmerge
jointype (thanks @sfranky for feature request #405)Ctrl+Y
paste from cell clipboard and other improvementsFor the full list, see below along with release notes from previous pre-releases, or view the CHANGELOG
Additions and Improvements
syspaste-
replayable and undoable (note that syspaste-
value will be recorded in CommandLog)Options
options.incr_base
(thanks @chocolateboy for the suggestion #647)options.force_valid_colnames
renamed to options.clean_names
options.default_height
for visibility toggle (thanks @frosencrantz for feature request #660)--
option-ending option on CLI.fancy_chooser
= True
s
to select, Enter
to choose current row, g Enter
to choose selected rows, q
to not choose anyCommand changes and additions
- (former) setcol-range (gz=
) renamed to setcol-iter
- (former) addcol-range-step
(i
) renamed to addcol-incr-step
- (former) setcol-range
(gi
) renamed to setcol-incr
- (former) addcol-range-step
(zi
) renamed to addcol-incr-step
- (former) setcol-range-step
(gzi
) renamed to setcol-incr-step
- add scroll-cells-*
to scroll display of cells while remaining in a Column; bind to [g]z{hjkl}
- (former) unbind z{hjkl} from scroll-col
(thanks @geekscrapy for feature request #662)
- add type-floatsi
bound to z%
(#661)
- reload-selected
now reloads all Sheets if none selected (thanks @geekscrapy for PR #685)
- add customdate with fixed fmtstr for parsing (use z@
and input a fmtstr compatible with strptime (thanks @suntzuisafterU for feature request #677)
Bugfixes
open-row
(thanks @cwarden for the bug report)gO
(thanks @geekscrapy for bug report #676)None
column names for all Sequence Sheet loaders (thanks @jsvine for bug report #680)options.null_value
to calculate its null column (thanks @aborruso for the bug report #675)expand-cols
) are set more frequently (thanks @frosencrantz for the bug report #668)
vlen()
(thanks @frosencrantz for bug report #690).visidata/plugins
by defaultreset_index()
to avoid losing data when updating a pandas index (thanks @ajkerrigan for PR #710)add-row
on ThreadsSheet (thanks @geekscrapy for bug report #713)deprecated
status
and statuses
from deprecated (thanks @frosencrantz for bug report #621)
open-status
and show-status
cursorColIndex
API and Interface
Sheet(*names, **kwargs)
autojoins list of name partsopenSource()
, aggregator()
, and aggregators
are now part of vdobjset_option
is now setOption
isError
to Column.isError
load_pyobj
, now PyobjSheet
.getall('foo_')
which returns all options prefixed with 'foo_'
; deprecated options('foo_')
nSelected
is now nSelectedRows
Column.width
property, so setting is same as Column.setWidth
evalexpr
is now evalExpr
format
is now formatValue
SettableColumn.cache
is now ._store
vdtype()
is now vd.addType()
addColumnAtCursor
(thanks @geekscrapy for bug report #714)Plugins
plugins-deps
(former plugin-deps)Dev niceties
z Ctrl+S
First and foremost, the 'defermods' feature has been reintegrated into core VisiData.
It was added in v2.-1, but it caused some headaches, so we separated it out into a plugin for v2.-2, along with vls
for the DirSheet.
Then we found that we really missed having the functionality right in vd alongside everything else, and not having to reach for a specialized tool.
@anjakefala got to the bottom of our headaches and did the heavy lifting to make sure that everything works properly now.
So now the DirSheet and SqliteSheets are once again able to 'defer' their modifications and deletions, until saved to the source with z Ctrl+S
. Ctrl+S
saves the sheet to a regular data file as usual.
See also the defermods page.
Thanks to @anjakefala for her diligence and hard work on this!
unfurl-col
bound to zM
)As suggested by @jsvine, unfurl is a row-wise expansion of a column with containers.
expand-col
does a column-wise expansion: 1 column is added for each key/value in the containers (assumes mostly homogenous data)melt
converts non-key columns into rows (on a new melted sheet)unfurl-col
is kind of like a shortcut for an expand followed by a melt (demo on twitter)In my mind, unfurl
is conceptually closer to expand-col
, but since it pushes a new sheet, putting it on a Shift+ command feels more natural.
The unfurl-col
command feels like a focused melt--melting lists or dicts in the cursor column, instead of the individual values of the non-key columns as melt
does.
So it's now bound to z Shift+M
.
Generating a range of numbers turns out to be surprisingly handy.
Previously, if you wanted to make a column with a list of numbers, you'd have to use za
to create a column, gs
to select all the rows (losing your previous selection) gz=
(setcol-range
array languages, the 'increment' operator generates a sequence of integers from whole cloth.
In fact there was a version of this in the rownum plugin, and another version in @jsvine's unfurl plugin.
So we added equivalent commands to stock VisiData.
Because of the tradition of using i
-like characters in APL notation ('ι' in APL and 'i.' in J), and the coincidence
that i
has remained one of the few unbound keystrokes, I decided to develop this set of increment concepts, and bind them to the i
family of commands.
See below for the new commands.
We had a couple of open issues with command line options, and finally I bit the bullet and just wrote a custom cmdline args parser, instead of using Python's argparse
. It was actually about the same amount of code, but now the syntax is more regular, more permissive, and can set sheet-specific options multiple times and differently for different sheets.
Thanks to @tsibley for patient testing and precise bug reports.
See /options#cli for details on how the command line interface works.
Also the visidata_dir
option (default $HOME/.visidata
) can now be set via the environment variable $VD_DIR
.
Likewise config
can be set via $VD_CONFIG
.
fancy_chooser
Setting the fancy_chooser
option to True enables a fancy selection menu for adding aggregators and choosing jointypes.
Help text is included for each item; press Enter
to choose a single item, or select multiple rows and press g Enter
, or q
to abort.
This uses the splitpane functionality from the previous release.
Python has multiple syntaxes for formatting numbers within strings: %.02f
which used with the %
format operator, and {:.02f}
used with .format().
Which should you use for in the fmtstr
attribute on the Columns sheet? A Twitter poll was evenly split, and @tsibley suggested ¿porque no los dos?](https://twitter.com/trs/status/1182390622507827202)
So as of v2.-4, you can use either format mechanism! If you want thousands separators though, you have to use {:,.02f}
. See /blog/fmtstr for details.
IMAP (email): open an imap:// url and it'll download all your email, which you can then save to .jsonl like I did
basic MySQL loader (requires ..; thanks @ )
basic PDF text extractor (requires pdfminer)
improved loaders: csv hdf5 html http json jsonl pandas pcap postgres xls yaml
Thanks to @ajkerrigan for actively following up on the pandas and json bug reports, and all of his work in making them better.
z Shift+M
unfurl-col
i
addcol-range
adds a column with integer values reflecting the current row order.
gi
setcol-range
sets values in the current column for selected rows
zi
addcol-range-step
adds a column with values
gzi
setcol-range-step
sets values
x
(Canvas) resize-x-input
sets x axis dimensions on a plot
y
(Canvas) resize-y-input
sets y axis dimensions on a plot
(unbound) select-error
(unbound) select-error-col
(unbound) mouse-enable
and mouse-disable
(unbound) guard-sheet
sets quitguard on current sheet
And of course there are tons of bugfixes and smaller improvements throughout. For a more complete list, see the CHANGELOG.
We are starting off the New Year with a very small patch for a few bugs.
Briefly,
g*
Ctrl+Z
), VisiData will now correctly resume in the editline.Ctrl+W
on an empty value in editline does not error out of the editline.Happy new year, everyone!
The initial motivation for this patch was to fix an idle performance regression. In the interim, though, we have received a bunch of feedback for improvements and a couple of feature requests.
So thanks for all of your ongoing engagement and for continuing to share VisiData with the world. We hope you enjoy this final release of 2018!
A brief overview:
Improvements to the pandas loader.
When set to True options.bulk_select_clear
bulk select commands (|
, g|
, ,
, etc) will clear the previously selected rows.
Shift+O
once again pushes the global options sheet. You can find the sheet options by pressing zO
. gO
now opens the .visidatarc
which can be edited and saved from within the VisiData interface.
Sorting is now asynchronous, per user request. Please let us know how you find it.
gz^
now renames all visible columns to contents of selected rows and gz*
substitutes over all visible columns
As usual, the complete list of changes can be found in the Changelog.
For the most part, this is a bugfix release. A few other improvements are here as well:
Basic plugin support
~/.visidata
added to sys.path on startup~/.visidata/vdfoo.py
import vdfoo
to .visidatarc
to activateError saving
options.safe_error
string (default #ERR
)Mouse improvements
xls/xlsx loaders now use options.header
to determine number of rows used to set column names (default is 1).
See the CHANGELOG for a more complete list of bugfixes and changes.
This is largely a bugfix and performance release. It was originally planned as a patch release (v1.3.2), but some features and interface changes crept in, so it is officially v1.4.
visidata.view(obj)
and visidata.view_pandas(df)
-f pandas
loads file with pandas.read_<ext>
As usual, a more complete list of changes and features is in the CHANGELOG.
See the ROADMAP for the planned future direction of VisiData.
We found some issues with 1.3 (aggregators interacting with nulls/errors, primarily) that we didn't want to let sit until 1.4. So we fixed those issues and a couple others, and added a few 'minor' features. This patch version should be a definitive improvement over the base 1.3 version.
The complete list of changes is in the CHANGELOG. Here are the new options and features:
extend
join type keeps the type of the first sheet, extending it with columns from the other sheetsrename-sheet
command (thanks to @jsvine for suggestion; what default keybinding should it have?)reload-rows
(gz^R
) to undo modifications on all selected rowsIt's been a productive 3 months since v1.2. The largest effort in this release was a commands/options reworking, which will hopefully pay dividends in the future. Many other so-called improvements were made as well. Here's a list of most of them:
commands.tsv
is an exhaustive list of commands and their attributes and side effects.Ctrl+H
, which should be its final resting place.
F1
will still open the manpage if the terminal doesn't intercept it.z?
has been repurposed (see below).Ctrl+H
as Backspace
, these help commands are also available by using Backspace
(backspace for help, a new trend).z Ctrl+H
opens a list of commands available on this sheet.Space
) has been removed.Space
(exec-longname
) executes the command for the input longname (tab completion of available commands is supported). (This function was previously bound to Ctrl+A
).options.wrap
(for TextSheet wrapping of lines) now defaults to False
.R
(random-sheet
) opens a new sheet instead of selecting random rows (reverting to former behavior).za
(addcol-empty
) asks for column namezd
(delete-cell
) moves value to clipboard ("cut", like other delete commands)Shift+O
opens options for the current sheet type, and g Shift+O
opens the global options sheet.Space
and then typing the longname colors
.color_error
and color_warning
(thanks to @jsvine for suggestion)options.quitguard
(default False
to keep old behavior) if True, will confirm before quitting last sheet.sheets-graveyard
(gS
) command opens a sheet that shows all discarded (but "precious") sheets. These are stored as weak references so they will be garbage collected eventually, but can be resurrected from the graveyard sheet until then.options.safety_first
(default False
) makes loading/saving more robust, likely at the cost of performance which can become significant in large files.
options.tsv_safe_char
is split into tsv_safe_newline
and tsv_safe_tab
.z;
(addcol-sh
) adds new columns for stdout/stderr of a bash
command, which uses $colname
to substitute values from other columns (whole arguments only, so far).z|
(select-expr
) and z\
(unselect-expr
) select/unselect by Python expression (thanks to @jsvine for suggestion).z/
(search-expr
) and z?
(searchr-expr
) to search forward/backward by Python expression.gI
(describe-all
) describes all columns in all sheeets (like gC
(columns-all
)).g(
, z(
, and gz(
variants of (
('expand-column') are filled out.z#
sets type of current column to len
.date
supports adding a number of days (or like foo+6*hours
, foo+9*months
, etc).options.motd_url
now uses https by default (thanks to @jsvine for the warning).mode
is editable (set to octal like 0o0644
).Ctrl+S
(save-sheet
) to an existing file gets stuck in an infinite loop when options.confirm_overwrite
is on.Ctrl+R
(reload-sheet
) is required to refresh the ext
column for that row.n
/N
(next-search
/prev-search
) won't continue a previous search-expr
and searchr-expr
.show-aggregate
with mean errors on int
columns.)
) a previously expanded column on a dup-ed (with "
) sheet results it in disappearing on the source sheet.Thanks to everyone who contributed to this release! As always, feedback and suggestions are welcome and appreciated.