def test_none_missing_raises(): df = pd.DataFrame(np.random.randn(5, 3)) df.iloc[0, 0] = np.nan with pytest.raises(AssertionError): ck.none_missing(df) with pytest.raises(AssertionError): dc.none_missing()(_add_n)(df, n=2)
def test_none_missing(): df = pd.DataFrame(np.random.randn(5, 3)) result = ck.none_missing(df) tm.assert_frame_equal(df, result) result = dc.none_missing()(_add_one)(df) tm.assert_frame_equal(result, df + 1)
def test_none_missing(): df = pd.DataFrame(np.random.randn(5, 3)) result = ck.none_missing(df) tm.assert_frame_equal(df, result) result = dc.none_missing()(_add_n)(df, 2) tm.assert_frame_equal(result, df + 2) result = dc.none_missing()(_add_n)(df, n=2) tm.assert_frame_equal(result, df + 2)
def read_file(file_path): if file_path.lower().endswith(".json"): feedback = pd.read_json(file_path) ec.is_shape(feedback, (-1, 5)) elif file_path.lower().endswith(".csv"): feedback = pd.read_csv(file_path) ec.is_shape(feedback, (-1, 6)) else: raise ValueError("This file format is not supported yet.") try: ec.none_missing(feedback, [ "message", "airline_code", "number_of_fellow_passengers", "did_receive_compensation", "total_compensation_amount" ]) except AssertionError: print("Missing values") return feedback
def wrapper(*args, **kwargs): result = func(*args, **kwargs) ck.none_missing(result) return result
def check(data, ranges=ranges, dtypes=dtypes): ec.unique_index(data) ec.none_missing(data) ec.within_range(data, items=ranges) ec.has_dtypes(data, items=dtypes)