I need help..i'm trying to create a column where the new column is a previous date taken from date column..The result should resemble something like this..
description    date               count  previous date
abc               2010-01-05        1        NaT
khl                2010-01-08        3      2010-01-05 
nop               2010-01-10        6      2010-01-08
This is what I have done and my for loop seems to produce no results, it keeps on running forever I tried it many times.
skus=prod_by_date.Description.value_counts()
#Create empty dataframe
new_df= pd.DataFrame()
`for sku in skus:
    a=prod_by_date[prod_by_date.Description==skus[0]]
    a['previous_date']=a['date'].shift(1)
    new_df=pd.concat([new_df,a],axis=0)`
 
    