Esempio n. 1
0
    def test_len_o_should_return_the_number_of_records_where_outcome_is_0(self):
        df = pd.DataFrame(data=np.random.rand(6, 2), columns=["var1", "var2"])
        df["Outcome"] = [random.sample(range(2), 1)[0] for i in range(6)]

        length = df[df["Outcome"] == 0].shape[0]
        result = utils.len_o(df, outcome=0)

        self.assertEqual(length, result)
Esempio n. 2
0
    def test_len_o_should_return_the_number_of_records_where_outcome_is_1(
            self):
        df = pd.DataFrame(data=np.random.rand(6, 2), columns=['var1', 'var2'])
        df['Outcome'] = [random.sample(range(2), 1)[0] for i in range(6)]

        length = df[df['Outcome'] == 1].shape[0]
        result = utils.len_o(df)

        self.assertEqual(length, result)
Esempio n. 3
0
    def test_len_o_should_return_the_number_of_records_where_outcome_equals_0_and_outcome_col_is_not_default(
            self):
        df = pd.DataFrame(data=np.random.rand(6, 2), columns=['var1', 'var2'])
        df['Result'] = [random.sample(range(2), 1)[0] for i in range(6)]

        length = df[df['Result'] == 0].shape[0]
        result = utils.len_o(df, outcome=0, col_outcome='Result')

        self.assertEqual(length, result)