Skip to content

Commit

Permalink
Fix ZScores calculation. Closes #123.
Browse files Browse the repository at this point in the history
  • Loading branch information
onyxfish committed Sep 6, 2015
1 parent 9aa319b commit 8d547a0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
0.8.0
-----

* Fix computations.ZScores calculation. (#123)
* Differentiate sample and population variance and stdev. (#208)
* Support for overriding column inference with "force".
* Competition ranking implemented as default. (#125)
* Remove DateType and DateColumn.
Expand Down
10 changes: 4 additions & 6 deletions tests/test_computations.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ def test_z_scores(self):
self.assertEqual(len(new_table.rows), 4)
self.assertEqual(len(new_table.columns), 5)

self.assertSequenceEqual(new_table.rows[0], ('a', 2, 3, 4, -1))
self.assertSequenceEqual(new_table.rows[1], (None, 3, 5, None, 1))
self.assertSequenceEqual(new_table.rows[2], ('a', 2, 4, None, -1))
self.assertSequenceEqual(new_table.rows[3], ('b', 3, 4, None, 1))

self.assertSequenceEqual(new_table.columns['z-scores'],(-1,1,-1,1))
self.assertEqual(new_table.columns['z-scores'][0].quantize(Decimal('0.01')), Decimal('-0.87'))
self.assertEqual(new_table.columns['z-scores'][1].quantize(Decimal('0.01')), Decimal('0.87'))
self.assertEqual(new_table.columns['z-scores'][2].quantize(Decimal('0.01')), Decimal('-0.87'))
self.assertEqual(new_table.columns['z-scores'][3].quantize(Decimal('0.01')), Decimal('0.87'))

def test_zscores_invalid_column(self):
with self.assertRaises(UnsupportedComputationError):
Expand Down

0 comments on commit 8d547a0

Please sign in to comment.