cartoreader_lite.low_level.utils#

Utility functions to more easily read and write the CARTO3 files on a low level.

Functions

camel_to_snake_case(name)

convert_df_dtypes(df[, inplace])

convert_fname_to_handle(file, mode)

interp1d_dtype(x, y, *args, **kwargs)

interpolate_time_data(dfs, time_k, ...)

read_connectors(xml_elem, path_prefix)

Reads connector data from the main XML element, pointing to multiple files with the attached connector data.

read_contact_force(fname)

read_point_data(map_name, point_id[, ...])

Reads all the available point data for given map and point ID, along with its metadata.

simplify_dataframe_dtypes(df, dtype_dict[, ...])

snake_to_camel_case(name[, capitalize])

unify_time_data(dfs, time_k, time_interval)

xml_elem_to_dict(xml_elem)

xml_to_dataframe(xml_elem[, attribs])

xyz_to_pos_vec(data[, pos_label])

cartoreader_lite.low_level.utils.read_connectors(xml_elem: xml.etree.ElementTree.Element, path_prefix: str) Dict[str, List[pandas.core.frame.DataFrame]]#

Reads connector data from the main XML element, pointing to multiple files with the attached connector data.

Parameters
  • xml_elem (Element) – The XML Connector element where the data will be found

  • path_prefix (str) – The path prefix where to search for the connector files

Returns

A dictionary mapping from the connector names to the associated pandas DataFrames that will contain the connector data.

Return type

Dict[str, List[pd.DataFrame]]

cartoreader_lite.low_level.utils.read_point_data(map_name: str, point_id: int, path_prefix: Optional[str] = None) Tuple[Dict, Dict]#

Reads all the available point data for given map and point ID, along with its metadata.

Parameters
  • map_name (str) – Name of the map

  • point_id (int) – Point ID to read

  • path_prefix (str, optional) – Path prefix used while looking for files. Will default to the current directory

Returns

A tuple containing both a dictionary of metadata and the actual data

Return type

Tuple[Dict, Dict]