From 29233d5228cccb4a5e8e407933a80659bed816ae Mon Sep 17 00:00:00 2001 From: Mali Akmanalp Date: Mon, 28 Mar 2016 19:02:45 -0400 Subject: [PATCH] Move to less stringent check of index when loading table --- classification.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/classification.py b/classification.py index c5d8b58..90659ce 100644 --- a/classification.py +++ b/classification.py @@ -175,11 +175,8 @@ def validate(self): assert self.table.index.hasnans is False assert self.table.index.values[0] == 0 - # Use gauss's trick to check that the index is 0,1,2,3 ... n - index_size = self.table.index.size - sum_guess = (index_size - 1) * (index_size) / 2 - actual_sum = sum(self.table.index) - assert sum_guess == actual_sum + # Check that index is in sorted order + assert sorted(self.table.index) == self.table.index.tolist() assert (self.table[["name", "level", "code"]].isnull() .any().any() == False)