У меня есть фрейм данных
Software Product Case Number Created date End date CS date
MDM9607.LE.1.0 2774904 2/3/2017 3/4/2019
MDM9607.LE.1.0 2774203 8/7/2017 3/9/2018 7/8/2016
MDM9607.LE.1.0 2768088 9/3/2018 1/2/2019
MDM9607.LE.1.0 2767500 10/10/2016 3/4/2017 3/2/2015
MDM9607.LE.1.0 2764617 11/12/2017 8/5/2018 4/5/2016
здесь я использую два условия
if f9 f9['Created date'] < f9['End date']
f9['Status'] = np.select([ m2], ['EOL'])
и
if f9['Created date'] > f9['End date']
f9['Num of days'] = (f9['Created date'] - f9['CS date']).dt.days
m1 = f9['Num of days'].isna()
m2 = f9['Num of days'] > 365
m3 = f9['Num of days'] < 365
f9['Status'] = np.select([m1, m2, m3], ['U','L', 'N']
Software Product Case Number Created date End date CS date Sta
MDM9607.LE.1.0 2774904 2/3/2017 3/4/2019 L
MDM9607.LE.1.0 2774203 8/7/2017 3/9/2017 7/8/2016 Y
MDM9607.LE.1.0 2768088 9/3/2018 1/2/2019 NMDM9607.LE.1.0 2767500 10/10/2016 3/4/2017 3/2/2015 L
MDM9607.LE.1.0 2764617 11/12/2017 8/5/2018 4/5/2016 N
Я использовал код выше, но я получил
File "<ipython-input-134-3943efb08731>", line 1
if SyntaxError: invalid syntax