Example #1
0
 def test6(self):
     sr = pd.Series([5, 4])
     exp = 40 / 81
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #2
0
 def test7(self):
     sr = pd.Series([5, 5])
     exp = 1 / 2
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #3
0
 def test5(self):
     sr = pd.Series([1, 15])
     exp = 15 / 128
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #4
0
 def test4(self):
     sr = pd.Series([10, 0])
     exp = 0
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #5
0
 def test3(self):
     sr = pd.Series([5, 4, 3])
     exp = 94 / 144
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #6
0
 def test2(self):
     sr = pd.Series([3, 3, 3])
     exp = 2 / 3
     np.testing.assert_almost_equal(exp, gini_series(sr))
Example #7
0
 def test_empty(self):
     sr = pd.Series(dtype='float64')
     exp = 1
     self.assertEqual(exp, gini_series(sr))