cast_to_common_type#

pandas_utils.utility.cast_to_common_type(items_to_cast)#

Cast N objects to the same datatype.

The passed in objects must have the dtype attribute, and a call to astype(new_type) must return a copy of the object as new_type. Most, if not all, pandas objects meet the criteria.

np.result_type() is used internally to find a common datatype.

Parameters:

items_to_cast (Sequence[Series]) – The items to cast to a common dtype.

Returns:

All of the items passed in, cast to a common datatype

Return type:

cast_items