Skip to content

Records

ResultContent

Bases: Record

ResultValue

Attributes:

Name Type Description
value_id int

value id

value Any

value

Source code in minto/records/records.py
class ResultContent(Record):
    """ResultValue

    Attributes:
        value_id (int): value id
        value (Any): value
    """

    result_id: StrictInt
    content: Any

get_pandas_dtypes(dtypes)

isinstance

Parameters:

Name Type Description Default
dtypes dict[str, Type[Any]]

dtypes

required

Returns:

Name Type Description
T dict[str, str]

value

Source code in minto/records/records.py
def get_pandas_dtypes(dtypes: dict[str, Type[Any]]) -> dict[str, str]:
    """isinstance

    Args:
        dtypes (dict[str, Type[Any]]): dtypes

    Returns:
        T: value
    """

    uint_types = [np.uint8, np.uint16, np.uint32, np.uint64]
    int_types = [int, np.int8, np.int16, np.int32, np.int64]
    float_types = [float, np.float16, np.float32, np.float64]
    complex_types = [complex, np.complex64, np.complex128]

    pandas_dtypes: dict[str, str] = {}
    for k, v in dtypes.items():
        if v is StrictInt:
            pandas_dtypes[k] = "int"
        elif v is StrictFloat:
            pandas_dtypes[k] = "float"
        elif v in (bool, StrictBool):
            pandas_dtypes[k] = "boolean"
        elif v in (str, StrictStr):
            pandas_dtypes[k] = "string"
        elif v in (datetime.date, datetime.datetime):
            pandas_dtypes[k] = "datetime64[ns]"
        elif v is datetime.timedelta:
            pandas_dtypes[k] = "timedelta64[ns]"
        elif v in uint_types + int_types + float_types + complex_types:
            pandas_dtypes[k] = v.__name__
        else:
            pandas_dtypes[k] = "object"
    return pandas_dtypes