maxframe.dataframe.infer_dtype#
- maxframe.dataframe.infer_dtype(obj: Any) ArrowDtype | ExternalBlobDtype[source]#
Infer MaxFrame-compatible dtype from a Python object.
Creates a single-element PyArrow array from the object to infer its type, then converts to MaxFrame-compatible dtype using the dtype() function.
- Parameters:
obj (Any) – Python object to infer dtype from. Can be: - Scalar values (int, float, bool, str, bytes) - Lists/tuples (for list/array types) - Dicts (for struct types) - Blob objects (SolidBlob) - Any other Python object supported by PyArrow
- Returns:
Inferred dtype for the object.
- Return type:
ArrowDtype or ExternalBlobDtype
- Raises:
TypeError – If the object type is not supported or dtype cannot be inferred.
Examples
>>> import maxframe.dataframe as md >>> md.infer_dtype(42) ArrowDtype(int64[pyarrow])
>>> md.infer_dtype(3.14) ArrowDtype(double[pyarrow])
>>> md.infer_dtype("hello") StringDtype(pyarrow)
>>> md.infer_dtype([1, 2, 3]) ArrowDtype(list<item: int64>[pyarrow])
>>> md.infer_dtype({"a": 1, "b": 2}) ArrowDtype(struct<a: int64, b: int64>[pyarrow])