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