Beispiel #1
0
def pytest_generate_tests(metafunc):
    _test_suite = get_series()
    _test_suite.update(get_geometry_series())
    if metafunc.function.__name__ in ["test_consistency", "test_traversal_mutex"]:
        argsvalues = []
        for name, series in _test_suite.items():
            args = {"id": name}
            argsvalues.append(pytest.param(name, series, **args))

        metafunc.parametrize(argnames=["name", "series"], argvalues=argsvalues)
    get_convert_cases,
    get_inference_cases,
    infers,
)

from pandas_profiling.config import config
from pandas_profiling.model.typeset import (
    Boolean,
    Categorical,
    DateTime,
    Numeric,
    ProfilingTypeSet,
    Unsupported,
)

series = get_series()

typeset = ProfilingTypeSet()

contains_map = {
    Numeric: {
        "int_series",
        "Int64_int_series",
        "int_range",
        "Int64_int_nan_series",
        "int_series_boolean",
        "np_uint32",
        "pd_uint32",
        "float_series",
        "float_series2",
        "float_series3",
    DateTime,
    Float,
    Generic,
    Integer,
    Object,
    String,
    TimeDelta,
)
from visions.typesets.standard_set import StandardSet


def reload_series_to_numpy(s):
    return np.array(s.tolist())


array = get_series()
array.update(get_geometry_series())
array = {k: v.to_numpy() for k, v in array.items()}

# Pandas doesn't correctly handle complex categoricals pending
# https://github.com/pandas-dev/pandas/pull/36482/
array.pop("categorical_complex_series")

# Some sequences don't round trip correctly from pandas (i.e. Series.to_numpy()
# is not equivalent to np.array(Series.tolist())
array["Int64_int_series"] = reload_series_to_numpy(array["Int64_int_series"])
array["pd_uint32"] = reload_series_to_numpy(array["pd_uint32"])

typeset = StandardSet() - Categorical

contains_map = {