Generation

generate functionSat, 11 Feb 2023

There is Pandas dataframe: Date Notifications Times opened Conversion 6 09/01/2022 23 57 2.478261 10 09/05/2022 24 51 2.125000 8 09/03/2022 15 25 1.666667 1 08/27/2022 43 48 1.116279 9 09/04/2022 29 30 1.034483 17 09/12/2022 99 102 1.030303 Write a function that will change all values > 1 in the Conversion column to 1

def change_conv_to_one(df): df.loc[df['Conversion'] > 1, 'Conversion'] = 1 return df

Questions about programming?Chat with your personal AI assistant