def check_for_empty_index(comparable: Compare): """ Find row number of empty values in the index column """ index_column = comparable.data_frame[idx.get_index_name(comparable)] comparable.empty_index = [index for index, value in enumerate(index_column) if value == Field.empty_string.value or value != value or value is None]
def test_drop_empty_index(self, mock_index): comparable = Compare() comparable.index_column_name = mock_index d = {'id': ['', '', 'str', 'abc', 'abc', '', None]} comparable.data_frame = pd.DataFrame(data=d, dtype="object") comparable.empty_index = [0, 1, 5, 6] index_validator.drop_empty_index(comparable) expected = ['str', 'abc', 'abc'] actual = list(comparable.data_frame["id"]) assert expected == actual