Python Pandas DateOffset using value from another column

pandas, python, time-series

Solution

In [12]: df['C'] = df['A'] + df['B'].apply(pd.offsets.Day)

In [13]: df
Out[13]: 
           A  B          C
0 2013-01-01  0 2013-01-01
1 2013-01-02  1 2013-01-03
2 2013-01-03  2 2013-01-05
3 2013-01-04  3 2013-01-07
4 2013-01-05  4 2013-01-09

Problem

I was thinking this would be very easy but the below is not working for what I want. Just trying to compute a new date column by adding days to a pre-existing datetime column using values from another column. My 'offset' column below just has 1 digit numbers. ``` df['new_date'] = df['orig_date'].apply(lambda x: x + pd.DateOffset(days=df['offset'])) ``` Error: `unsupported type for timedelta days component: Series` thank you,

Original source