Groupby.std

Obtain the standard deviation per groups for specified columns

danfo.Groupby.std() [source]

Parameters: None

Return: DataFrame

Examples

Obtain the standard deviation of a column for each group, group by one column

const dfd = require("danfojs-node")


let data ={A: ['foo', 'bar', 'foo', 'bar',
                'foo', 'bar', 'foo', 'foo'],
           B: ['one', 'one', 'two', 'three',
                'two', 'two', 'one', 'three'],
           C: [1,3,2,4,5,2,6,7],
           D: [3,2,4,1,5,6,7,8]
}

let df = new dfd.DataFrame(data)
let grp = df.groupby(["A"])
grp.col(["C"]).std().print()
 Shape: (2,2) 

╔═══╤═══════════════════╤═══════════════════╗
║   │ A                 │ C_std             ║
╟───┼───────────────────┼───────────────────╢
║ 0 │ foo               │ 2.58843582110...  ║
╟───┼───────────────────┼───────────────────╢
║ 1 │ bar               │ 1                 ║
╚═══╧═══════════════════╧═══════════════════╝

Obtain the std for two columns for each group, group by one column

Obtain the std for a column for each group, group by two columns

Obtain the std for two columns for each group, group by two columns


Last updated

Was this helpful?