I'd like to create a random numeric Pandas series and assign to the DataFrame. My DataFrame has an id
column, however, it is alphanumeric which causes some issues when doing querying the data from a SQL database.
Therefore, I'd like to create a randomly generated numeric column.
import pandas as pd
df = pd.DataFrame({'name': ['A', 'B', 'C'],
'id': [1, 2, 3]
})
The randomly generated numeric id
column should be of length 6.
Expected output:
name id rid
A 1 731721
B 2 831273
C 3 831212