ValueError: Cannot set a frame with no defined index and a value that cannot be converted to a Series

In most cases, this error comes when you return an empty dataframe. The best approach that worked for me was to check if the dataframe is empty first before using apply()

if len(df) !=  0:
    df['indicator'] = df.apply(assign_indicator, axis=1)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)