import pandas as pd
import numpy as np
l1 = [set(np.random.choice(list('abcdefg'), np.random.randint(1, 5))) for _ in
    range(100000)]
l2 = [set(np.random.choice(list('abcdefg'), np.random.randint(1, 5))) for _ in
    range(100000)]
df = pd.DataFrame({'A': l1, 'B': l2})
Set Union in pandas