I want to add a column( Stocks Needed) to the dataframe based on the condition below:
However, there is an error that appears at the else statement ( ^ SyntaxError: invalid syntax)
Any help, please?
condition = df1['Stocks'] > df1['Stocks for 7 days']
if condition:
df1['Needed Stock'] = 0
else:
df1['Needed Stock'] = df1['Stock for 7 days'].sub(df1['Stocks'], fill_value=0)