agate-stats 0.1.0 (alpha)

About

agate-stats adds additional statistical methods to agate.

Important links:

Install

To install:

pip install agatestats

For details on development or supported platforms see the agate documentation.

API

agatestats.patch()

Patch the methods of TableStats onto agate.Table.

class agatestats.table.TableStats
stdev_outliers(column_name, deviations=3, reject=False)

A wrapper around Table.where that filters the dataset to rows where the value of the column are more than some number of standard deviations from the mean.

This method makes no attempt to validate that the distribution of your data is normal.

There are well-known cases in which this algorithm will fail to identify outliers. For a more robust measure see TableStats.mad_outliers().

Parameters:
  • column_name – The name of the column to compute outliers on.
  • deviations – The number of deviations from the mean a data point must be to qualify as an outlier.
  • reject – If True then the new Table will contain everything except the outliers.
Returns:

A new Table.

mad_outliers(column_name, deviations=3, reject=False)

A wrapper around Table.where that filters the dataset to rows where the value of the column are more than some number of median absolute deviations from the median.

This method makes no attempt to validate that the distribution of your data is normal.

Parameters:
  • column_name – The name of the column to compute outliers on.
  • deviations – The number of deviations from the median a data point must be to qualify as an outlier.
  • reject – If True then the new Table will contain everything except the outliers.
Returns:

A new Table.

pearson_correlation(column_one, column_two)

Calculates the Pearson correlation coefficient for column_one and column_two.

Returns a number between -1 and 1 with 0 implying no correlation. A correlation close to 1 implies a high positive correlation i.e. as x increases so does y. A correlation close to -1 implies a high negative correlation i.e. as x increases, y decreases.

Note: this implementation is borrowed from the MIT licensed latimes-calculate. Thanks, LAT!

Parameters:
  • column_one – The name of a column.
  • column_two – The name of a column.
Returns:

decimal.Decimal.

class agatestats.computations.ZScores(column_name)

Computes the z-scores (standard scores) of a given column.

Authors

The following individuals have contributed code to agate-stats:

  • Christopher Groskopf

License

The MIT License

Copyright (c) 2015 Christopher Groskopf and contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Changelog

0.1.0

  • Initial version.

Indices and tables