* Generate descriptive statistics. * Descriptive statistics include those that summarize the central tendency, * dispersion and shape of a dataset’s distribution, excluding NaN values. * @example * ``` * const sf = new Series([1, 2, 3, 4, 5, 6]); * const sf2 = sf.
()
| 890 | * ``` |
| 891 | */ |
| 892 | describe(): Series { |
| 893 | if (this.dtypes[0] == "string") { |
| 894 | throw new Error("DType Error: Cannot generate descriptive statistics for Series with string dtype") |
| 895 | } else { |
| 896 | |
| 897 | const index = ['count', 'mean', 'std', 'min', 'median', 'max', 'variance']; |
| 898 | const count = this.count(); |
| 899 | const mean = this.mean(); |
| 900 | const std = this.std(); |
| 901 | const min = this.min(); |
| 902 | const median = this.median(); |
| 903 | const max = this.max(); |
| 904 | const variance = this.var(); |
| 905 | |
| 906 | const data = [count, mean, std, min, median, max, variance]; |
| 907 | const sf = new Series(data, { index: index }); |
| 908 | return sf; |
| 909 | |
| 910 | } |
| 911 | } |
| 912 | |
| 913 | |
| 914 | /** |