load_from_csv¶
-
ampligraph.datasets.
load_from_csv
(directory_path, file_name, sep='\t', header=None)¶ Load a csv file
Loads a knowledge graph serialized in a csv file as: .. code-block:: text
subj1 relationX obj1 subj1 relationY obj2 subj3 relationZ obj2 subj4 relationY obj2 …
Note
Duplicates are filtered.
Parameters: - folder_name (str) – base folder within AMPLIGRAPH_DATA_HOME where the file is stored.
- file_name (str) – file name
- sep (str) – The subject-predicate-object separator (default ).
- header (int, None) – The row of the header of the csv file. Same as pandas.read_csv header param.
Returns: triples – the actual triples of the file.
Return type: ndarray , shape [n, 3]
Examples
>>> from ampligraph.datasets import load_from_csv >>> X = load_from_csv('folder', 'dataset.csv', sep=',') >>> X[:3] array([['a', 'y', 'b'], ['b', 'y', 'a'], ['a', 'y', 'c']], dtype='<U1')