locan.locan_io.locdata.utilities.convert_property_types#
- locan.locan_io.locdata.utilities.convert_property_types(dataframe, types, loc_properties=None)[source]#
Convert data types according to the column-type mapping in types. If the target type is one of ‘integer’, ‘signed’, ‘unsigned’, ‘float’ then
pandas.to_numeric()
will be applied. Otherwise, if the target type is any type object like int, str, np.float64 or similar thenpandas.astype()
will be applied.- Parameters:
dataframe (
DataFrame
) – Data to be convertedtypes (
Mapping
[str
,str
|type
]) – Mapping of loc_properties to typesloc_properties (
Optional
[Iterable
[str
]]) – The columns in dataframe to be converted. If None, all columns will be converted according to types.
- Returns:
A copy of dataframe with converted types
- Return type:
pandas.DataFrame