As of today, on the latest 2.2 version of pandas, this correctly returns an empty Series if you apply on an empty dataframe. I have the same problem with 1.2 version where I have to explicitly add the result_type='reduce'
argument while I dont have any problems with the 2.2 version.
E.g.,
import pandas as pd
df = pd.DataFrame(columns=['A', 'B'])
# only works in 1.2 version if I add result_type='ignore'
df['C'] = df.apply(lambda x: {x['A'], x['B']}, axis=1, result_type='reduce')
# works fine in 2.2 without any additional args
df['C'] = df.apply(lambda x: {x['A'], x['B']}, axis=1)
Must have been a bug or smth in earlier versions.