I have the following indexed DataFrame with named columns and rows not- continuous numbers:
a b c d 2 0.671399 0.101208 -
Doing this directly via NumPy will be the most efficient:
df1['e'] = np.random.randn(sLength)
Note my original (very old) suggestion was to use map (which is much slower):
map
df1['e'] = df1['a'].map(lambda x: np.random.random())