I have a dataframe

```
 id |start|stop|join_date
 233| 0   | 12 |2015-01-01
 234| 0   | 12 |2013-03-04
 235| 10  | 23 |2014-01-10

```

**GOAL:**

I want to create another column `stop_date` that offsets the `join_date` based on whether or not the `start` date is 0.

If the `start` is 0 then `stop_date` is the `join_date` is offset by the months in `stop`

If the `start` is not 0 then `stop_date` is the `join_date` is offset by the months in `stop` and the months in `start`

I wrote the following function:

```
def stop_date(x):
    if x['start'] == 0:
        return x['join_date'] + x['stop'].astype('timedelta64[M]')
    elif x['start'] != 0 :
        return x['join_date'] + x['start'].astype('timedelta64[M]') + x['stop'].astype('timedelta64[M]')
    else:
        return x

```

I tried to apply to the dataframe by:

```
df['stop_date'] = df.apply(stop_date, axis = 1)

```

I keep getting an error : AttributeError: ("'int' object has no attribute 'astype'", 'occurred at index 0')
I cannot figure out how to achieve this.