I have the following dataframe
:
import pandas as pd
data = [['onto.modify', 'onto.ModificationAction1']]
df = pd.DataFrame(data, columns=['queries', 'corpus'])
queries corpus
0 onto.modify onto.ModificationAction1
The elements of corpus column
are Individuals
of a particular Class
of an ontology
called ontology2
.
I want to add the elements of the queries column
as individuals
to the same Class
that the elements of the corpus column
belong to.
For example, if the onto.ModificationAction1
belong to the ontology2.Thing class
the same must be for the ontology2.modify
.
Initially, I loop over the corpus columns
to find in which Class
each Individual
belongs to:
for elements in df["corpus"]:
print (element.is_a)
However, I get back:
AttributeError: 'str' object has no attribute 'is_a'
So how do I solve this error and eventually perform what I am describing above in the example?