I am a beginner in python. I am trying to add a prefix to one of my columns in pandas if it meets a certain condition but i get the following error "ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all()."
Below is my code
import pandas as pd
df = pd.DataFrame({'sk': [100, 234, 3333, 4569], 'lk': ['A', 'B', 'C', 'D']})
df['sk'] = df['sk'].astype(str)
length = df['sk'].apply(len)
if length == 3:
df['sk'] = 'CE0' + df['sk']
else:
df['sk'] = 'CE' + df['sk']
df