Generation

generate functionFri, 03 Feb 2023

generate a unique id for each line of the pandas dataframe

import pandas as pd def get_line_id(row): return row.name df['line_id'] = df.apply(lambda row: get_line_id(row), axis=1)

Want to kickstart your project?Use the new AI Studio to create your code