array multiple values in a df pandas

Viewed 15

i think this is a simple one but I'm really struggling to google to correct terminology to find what i want ..

i have these 3 data strings:

ID = [1,2,3,4,5]
radius_rings = ['0_300','300_600','600_900']
year = [2010,2011,2012,2013]

and i would like to duplicate the ID, adding many more rows, so it has every variation of radius ring & year.. something like this:

data = {'ID':[1,1,1,1,1,1,1,1,1,1,1,1], 'radius_rings': ['0_300', '0_300','0_300','0_300','300_600','300_600','300_600','300_600','600_900','600_900','600_900','600_900'], 'year':[2010,2010,2010,2011,2011,2011,2012,2012,2012,2013,2013,2013 ]}
df = pd.DataFrame(data)
df

i tried np.full, but it was a little sketchy and I'm sure there's a simple way to produce this ..

0 Answers
Related