hse-aml/competitive-data-science

Observation in the final exercise of week-1 task (Pandas Basics)

sayakpaul opened this issue · 1 comments

Hi. The instruction of the final task of PandasBasics says -

What was the variance of the number of sold items per day sequence for the shop with shop_id = 25 in December, 2014? Do not count the items, that were sold but returned back later.

So the code that followed for getting the rows filtered according to the given condition is -

transactions[(transactions.shop_id==25) & (transactions.date.dt.year==2014) & \
                              (transactions.date.dt.month==12) & (transactions.item_cnt_day>0.0)]

I included (transactions.item_cnt_day>0.0) to only consider items with no returns. And then take the variance accordingly. But this does not seem to work. When I omit the condition I get the answer to be correct. Could you please tell me where I am getting this wrong?

image

I had this issue also