repeat(a, repeats) with DataFrame and text

Viewed 20

I have an imported dataframe from an excel file which looks something like this; The input data imported with pd.read_excel

What I want to do is to create a new separate column vector which repeats the 'Event' column by the 'Duration'/30. I.e. something that looks like this; What I want the output to look like

I can do this easily in MATLAB with the 'repelem' function however I am having problems with getting 'repeat' to work with dataframe and non-int's.

# Broken Python attempt 
new_df = np.repeat(df.Event, df.Duration)
0 Answers
Related