MCPcopy Index your code
hub / github.com/javascriptdata/danfojs / describe

Method describe

src/danfojs-base/core/frame.ts:1792–1813  ·  view source on GitHub ↗

* Generate descriptive statistics for all numeric columns. * Descriptive statistics include those that summarize the central tendency, * dispersion and shape of a dataset’s distribution, excluding NaN values. * @example * ``` * const df = new DataFrame([[1, 2], [3, 4]], { co

()

Source from the content-addressed store, hash-verified

1790 * ```
1791 */
1792 describe(): DataFrame {
1793 const numericColumnNames = this.columns.filter(name => this.$getColumnDtype(name) !== "string")
1794 const index = ["count", "mean", "std", "min", "median", "max", "variance"];
1795 const statsObject: any = {};
1796 for (let i = 0; i < numericColumnNames.length; i++) {
1797 const colName = numericColumnNames[i];
1798 const $count = (this.$getColumnData(colName) as Series).count();
1799 const $mean = mean(this.$getColumnData(colName, false) as number[]);
1800 const $std = std(this.$getColumnData(colName, false) as number[]);
1801 const $min = (this.$getColumnData(colName) as Series).min();
1802 const $median = median(this.$getColumnData(colName, false) as number[]);
1803 const $max = (this.$getColumnData(colName) as Series).max();
1804 const $variance = variance(this.$getColumnData(colName, false) as number[]);
1805
1806 const stats = [$count, $mean, $std, $min, $median, $max, $variance];
1807 statsObject[colName] = stats;
1808
1809 }
1810
1811 const df = new DataFrame(statsObject, { index });
1812 return df
1813 }
1814
1815 /**
1816 * Drops all rows or columns with missing values (NaN)

Callers

nothing calls this directly

Calls 5

$getColumnDtypeMethod · 0.95
$getColumnDataMethod · 0.95
countMethod · 0.65
minMethod · 0.65
maxMethod · 0.65

Tested by

no test coverage detected