我有 Profile
对象的 ArrayList。 Profile
具有age
、gender
、country
等属性。
java中有没有什么库可以方便的给出描述性统计数据,比如女性资料的数量,男性资料的数量,来自美国的女性资料的数量,以及其他复杂的报告。
使用的环境是Google App Engine。
谢谢
最佳答案
您可以在 apache commons 数学中使用描述性统计信息,例如
// 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();
您需要将性别/国家/地区信息添加到 commons math 提供的 descriptiveStatistics 中。希望对您有所帮助。
关于java - Java ArrayList 的描述性统计,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14269392/