Catmandu-Stat
view release on metacpan or search on metacpan
lib/Catmandu/Exporter/Stat.pm view on Meta::CPAN
$exporter->add(
{ name => '#' , count => $self->counter }
);
my $has_overflow = 0;
for my $key (@keys) {
my $stats = {};
$stats->{name} = $key;
$stats->{count} = $self->{res}->{$key}->{count};
$stats->{min} = $self->get_stat($key)->min();
$stats->{max} = $self->get_stat($key)->max();
$stats->{mean} = $self->get_stat($key)->mean();
$stats->{variance} = sprintf "%.1f" , $self->get_stat($key)->variance();
$stats->{stdev} = sprintf "%.1f" , $self->get_stat($key)->standard_deviation();
my ($zeros,$zerosp,$occur_count,$values_count,$uniqs);
$zeros = $self->{res}->{$key}->{zero} // 0;
$values_count = $self->{res}->{$key}->{count};
$occur_count = $self->get_stat($key)->count();
$zerosp = sprintf "%.1f" , $occur_count > 0 ? 100 * $zeros / $occur_count : 100;
$uniqs = sprintf "%.1f" , $values_count > 0 ? 100 * $self->get_key_uniq($key) / $values_count : 0.0;
my $overflow = $values_count > 0 ? 100 * $self->get_key_uniq($key) / $values_count : 0.0;
$overflow = $overflow > 100 ? 1 : 0;
$stats->{zeros} = $zeros;
$stats->{'zeros%'} = $zerosp;
$stats->{'uniq~'} = floor($self->get_key_uniq($key));
$stats->{'uniq%'} = $uniqs;
( run in 0.418 second using v1.01-cache-2.11-cpan-49f99fa48dc )