pandas 1.4.2

NotesParametersReturnsBackRef
infer_dtype_from_array(arr, pandas_dtype: 'bool' = False) -> 'tuple[DtypeObj, ArrayLike]'

Notes

if pandas_dtype=False. these infer to numpy dtypes exactly with the exception that mixed / object dtypes are not coerced by stringifying or conversion

if pandas_dtype=True. datetime64tz-aware/categorical types will retain there character.

Parameters

arr : array
pandas_dtype : bool, default False

whether to infer dtype including pandas extension types. If False, array belongs to pandas extension types is inferred as object

Returns

tuple (numpy-compat/pandas-compat dtype, array)

Infer the dtype from an array.

Examples

This example is valid syntax, but we were not able to check execution
>>> np.asarray([1, '1'])
array(['1', '1'], dtype='<U21')
This example is valid syntax, but we were not able to check execution
>>> infer_dtype_from_array([1, '1'])
(dtype('O'), [1, '1'])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.dtypes.cast.infer_dtype_from_array

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/dtypes/cast.py#798
type: <class 'function'>
Commit: