W3cubDocs

/Nushell

dfr mean for expression

Creates a mean expression for an aggregation or aggregates columns to their mean value

Signature

> dfr mean {flags}

Input/output types:

input output
any any

Examples

Mean value from columns in a dataframe

> [[ab]; [62] [42] [22]] |dfr into-df|dfr mean
╭───┬──────┬──────╮
# │  a   │  b   │
├───┼──────┼──────┤
04.002.00
╰───┴──────┴──────╯

Mean aggregation for a group-by

> [[ab]; [one2] [one4] [two1]]
|dfr into-df
|dfr group-bya
|dfr agg (dfr colb|dfr mean)
╭───┬─────┬──────╮
# │  a  │  b   │
├───┼─────┼──────┤
0one3.00
1two1.00
╰───┴─────┴──────╯

Tips: Dataframe commands were not shipped in the official binaries by default, you have to build it with --features=dataframe flag

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/dfr_mean.html