Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

matrix transpose for filters

Transpose a matrix (swap rows and columns). For n-dimensional arrays, reverses all axes.

Signature

> matrix transpose {flags}

Input/output types:

inputoutput
matrixmatrix

Examples

Transpose a 2x3 matrix to a 3x2 matrix

> [[1 2 3] [4 5 6]] | into matrix | matrix transpose | matrix into-nu | to nuon
[[1.0, 4.0], [2.0, 5.0], [3.0, 6.0]]

Transpose an identity matrix (result is the same)

> matrix identity 2 | matrix transpose | matrix into-nu | to nuon
[[1.0, 0.0], [0.0, 1.0]]