统计

用于轻松高效数据处理的统计包,包含许多内置数学函数和单位。

用法

数字扩展

import 'package:statistics/statistics.dart';

void main() {
  var ns = [10, 20.0, 30];
  print('ns: $ns');

  var mean = ns.mean;
  print('mean: $mean');

  var sdv = ns.standardDeviation;
  print('sdv: $sdv');

  var squares = ns.square;
  print('squares: $squares');
}

输出

ns: [10, 20.0, 30]
mean: 20.0
sdv: 8.16496580927726
squares: [100.0, 400.0, 900.0]

统计

import 'package:statistics/statistics.dart';

void main() {
  var ns = [10, 20.0, 30];
  var statistics = ns.statistics;

  print('Statistics.max: ${ statistics.max }');
  print('Statistics.min: ${ statistics.min }');
  print('Statistics.mean: ${ statistics.mean }');
  print('Statistics.standardDeviation: ${ statistics.standardDeviation }');
  print('Statistics.sum: ${ statistics.sum }');
  print('Statistics.center: ${ statistics.center }');
  print('Statistics.squaresSum: ${ statistics.squaresSum }');

  print('Statistics: $statistics');
}

输出

Statistics.max: 30
Statistics.min: 10
Statistics.mean: 20.0
Statistics.standardDeviation: 21.602468994692867
Statistics.sum: 60.0
Statistics.center: 20.0
Statistics.squaresSum: 1400.0
Statistics: {~20 +-21.6024 [10..(20)..30] #3.0}

CSV

import 'package:statistics/statistics.dart';

void main() {
  var categories = <String, List<double?>>{
    'a': [10.0, 20.0, null],
    'b': [100.0, 200.0, 300.0]
  };

  var csv = categories.generateCSV();
  print(csv);
}

输出

#,a,b
1,10.0,100.0
2,20.0,200.0
3,0.0,300.0

来源

官方源代码 托管在GitHub

功能和 Bug

请在 问题跟踪器 提交功能请求和bug。

贡献

来自开源社区的任何帮助总是受欢迎且需要的

  • 发现问题?
    • 请提供详细信息提交bug报告。
  • 想要一个新功能?
    • 提出功能请求并附带使用场景。
  • 你正在使用并且喜欢这个项目吗?
    • 推广项目:写一篇文章、发帖或捐款。
  • 你是开发者吗?
    • 修复一个bug并提交一个pull request。
    • 实现新功能。
    • 改进单元测试。
  • 你是否已经提供过帮助?
    • 非常感谢我、贡献者以及所有使用这个项目的人!

如果您捐赠 1 小时的您的时间,您将贡献很多,
因为其他人也会这样做,只需参与并从您的一小时开始。

作者

Graciliano M. Passos

GitHub

https://github.com/gmpassos/statistics