Generation

generate functionFri, 03 Feb 2023

generate a unique id for each line of the pandas dataframe

def get_id(x): return x['user_id'] + '_' + x['item_id'] df['id'] = df.apply(get_id, axis=1)

Questions about programming?Chat with your personal AI assistant