Yup, creating the id column so they are as integers from the very beginning (as you did here) would certainly work. If you need to convert a categorical column to integers, this should work:
df['id'] = pd.to_numeric(df['id'])
Yup, creating the id column so they are as integers from the very beginning (as you did here) would certainly work. If you need to convert a categorical column to integers, this should work:
df['id'] = pd.to_numeric(df['id'])