MCPcopy Index your code
hub / github.com/datacamp/pythonwhat / test_data_frame

Function test_data_frame

pythonwhat/test_funcs/test_object.py:30–62  ·  view source on GitHub ↗

Test a pandas dataframe.

(
    state,
    name,
    columns=None,
    undefined_msg=None,
    not_data_frame_msg=None,
    undefined_cols_msg=None,
    incorrect_msg=None,
)

Source from the content-addressed store, hash-verified

28
29
30def test_data_frame(
31 state,
32 name,
33 columns=None,
34 undefined_msg=None,
35 not_data_frame_msg=None,
36 undefined_cols_msg=None,
37 incorrect_msg=None,
38):
39 """Test a pandas dataframe.
40 """
41
42 expand_msg = (
43 ""
44 if undefined_msg or not_data_frame_msg or undefined_cols_msg or incorrect_msg
45 else None
46 )
47
48 child = check_df(
49 state,
50 name,
51 undefined_msg,
52 not_instance_msg=not_data_frame_msg,
53 expand_msg=expand_msg,
54 )
55
56 # if columns not set, figure them out from solution
57 if columns is None:
58 columns = getColumnsInProcess(name, child.solution_process)
59
60 for col in columns:
61 colstate = check_keys(child, col, missing_msg=undefined_cols_msg)
62 has_equal_value(colstate, incorrect_msg=incorrect_msg)

Callers

nothing calls this directly

Calls 3

check_dfFunction · 0.90
getColumnsInProcessFunction · 0.90
check_keysFunction · 0.90

Tested by

no test coverage detected