Screen 486-7 Date Wrangling

https://app.dataquest.io/m/468/business-metrics/7/date-wrangling

years = list(range(2011,2015))
months = list(range(1,13))
yearmonths = [y*100+m for y in years for m in months]
yearmonths = yearmonths[:-1]

churn = pd.DataFrame({"yearmonth": yearmonths})
chrun = pd.merge(chrun, monthly_churn, 'left', left_on='yearmonth',right_index=True)
chrun.head()

What I expected to happen: the total_chruned from montly_chrun dataframe to appear in the merged dataframe

What actually happened: the final merged column contain duplicates of total_chruned labeled total_chruned_x, total_churned_y duplicated

My solution would be to rename one of these to total_chruned and drop the rest

Please update the instructions

Other details:

1 Like

I found the issue after performing dataframe.head() :smiley: Everything is fine :smiley:

1 Like

the total_chruned column disappears after performing a fill_na with inplace = true per instructions which is wierd

Fat fingered variable and it is fine :smiley:(also making sure I spell things correctly also helps).

Hi @manandwa,

I would be happy to help you with your query. Can you please provide more details on this?

Thanks,
Sahil

Hi Sahil,

It’s fixed it was more of an error on my part :smiley:

1 Like

I experienced the same occurrence. After hitting the merge statement again and churn.head() it disappeared