来自Java ArrayList的描述性统计信息

JR *_*lia 5 java google-app-engine arraylist

我有Profile对象的ArrayList .Profile有样特性age,gender,country等.

java中是否有任何库可以轻松提供描述性统计数据,例如女性档案的数量,男性档案的数量,来自美国的女性档案的数量,以及其他复杂的报告.

使用的环境是Google App Engine.

谢谢

ali*_*der 4

您可以在 apache commons math 中使用描述性统计,例如

// Get a DescriptiveStatistics instance
DescriptiveStatistics stats = new DescriptiveStatistics();

// Add the data from the array
for( int i = 0; i < inputArray.length; i++) {
        stats.addValue(inputArray[i]);
}

// Compute some statistics
double mean = stats.getMean();
double std = stats.getStandardDeviation();
Run Code Online (Sandbox Code Playgroud)

您需要将性别/国家/地区信息添加到 commons math 提供的描述性统计数据中。希望能帮助到你。