Pandas: Compare two Dataframe and Groupby categorical
Try:
Minimum reproducible example:
 A = pd.DataFrame({&quot;Text&quot;:[&quot;01&quot;, &quot;02&quot;,&quot;03&quot;,&quot;04&quot;], &quot;Category&quot;:[1,1,1,1]})
 B = pd.DataFrame({&quot;Text&quot;:[&quot;05&quot;, &quot;02&quot;,&quot;09&quot;,&quot;04&quot;], &quot;Category&quot;:[2,2,2,2]})

 C = pd.concat([A,B], ignore_index= True)

 C.groupby(&quot;Text&quot;).Category.unique().to_frame()

Result: