amtoine / nu_plugin_explore

A fast structured data explorer for Nushell.
GNU General Public License v3.0
19 stars 7 forks source link

transpose is not an involution #71

Open amtoine opened 3 months ago

amtoine commented 3 months ago

this boils down to the fact that, in Nushell, $table | transpose | transpose and $record | transpose | transpose are not the same as table and $record respectively, you'd have to define inverse commands such as

use std assert

def "transpose inv-record" []: {
    transpose --header-row | into record
}

def "transpose inv-table" []: {
    transpose --header-row
}

assert equal ($nu | transpose | transpose inv-record) $nu
assert equal (ls | transpose | transpose inv-table) (ls)