I need to create a primary key based in string columns in my dataframe
Month Name ID
01/01/2020 FileName1 - Example 1
01/02/2020 FileName2 - Example 2
01/03/2020 FileName3 - Example 3
I'm using the hash, but its generating the largest values, I would like that ID was the integer numbers. This is my code
all_data['unique_id'] = all_data._ID.map(hash)
where _ID is :
all_data['_ID'] = all_data['Month'].astype(str) + all_data['Name']
This group by return 0 for all rows
all_data['sequence']=all_data.groupby('_ID').cumcount()