Utilities¶
Load data and labels¶
Loads the edges and attributes files into Pandas dataframes and merges the labels of entities and relations to get.
-
wikidatasets.utils.
load_data_labels
(path, attributes=False, return_dicts=False)[source]¶ This function loads the edges and attributes files into Pandas dataframes and merges the labels of entities and relations to get.
Parameters: - path (str) – Path to the directory containing the edges.txt, attributes.txt, entities.txt, relations.txt files.
- attributes (bool) – Boolean indicating if we should read the attributes files. If False, then the edges file is read.
- return_dicts (bool) – Boolean indicating if the entities and relations labels dictionaries should be returned.
Returns: - df (pandas.DataFrame) – DataFrame containing either the edges or the attributes depending on the value of attributes.
- entities (pandas.DataFrame) – DataFrame containing the list of all entities and wikidata IDs and labels.
- relations (pandas.DataFrame) – DataFrame containing the list of all relations and wikidata IDs and labels.