Why am i getting SettingWithCopyWarning in this code? I know that when defining a new Dataframe, i need to use .copy(), but that doesn't help.
   def calc_quantity(input_df):
        when = input_df['SecurityId'].str.endswith(
            'TMS') | input_df['SecurityId'].str.endswith('TDS')
        input_df['Quantity'] = input_df['Quantity'].fillna(0).astype(float)
        input_df['Quantity'].loc[when] *= 100
            'TMS') | input_df['SecurityId'].str.endswith('TDS').copy()
        input_df['Quantity'] = input_df['Quantity'].fillna(0).astype(float).copy()
        input_df['Quantity'].loc[when] = input_df['Quantity'].loc[when]*100
        return input_df['Quantity']
 
    