I have this series
n_position
0 0.000000e+00
1 9.960938e-07
2 2.001953e-06
3 2.998047e-06
4 4.003906e-06
...
329 3.289941e-04
330 3.300000e-04
331 3.309961e-04
332 3.320020e-04
333 3.329980e-04
Name: Distance (m), Length: 334, dtype: float64
and this data frame
x (m) y (m) z (m) ...
n_position n_trigger n_channel n_pulse ...
0 0 1 1 -0.002926 0.001314 0.071339 ...
2 -0.002926 0.001314 0.071339 ...
4 1 -0.002926 0.001314 0.071339 ...
2 -0.002926 0.001314 0.071339 ...
1 1 1 -0.002926 0.001314 0.071339 ...
... ... ... ... ...
333 109 4 2 -0.002926 0.001647 0.071339 ...
110 1 1 -0.002926 0.001647 0.071339 ...
2 -0.002926 0.001647 0.071339 ...
4 1 -0.002926 0.001647 0.071339 ...
2 -0.002926 0.001647 0.071339 ...
[148296 rows x 36 columns]
I want to add the series as a column following the n_position index level. I am trying with
df[series.name] = series
but this adds the column with all the values NaN. Why? And, how can this be done?