Mar-24-2020, 12:41 AM
Hi,
I have the following dataframe and I would need to find the sequential invoice from each same name. Can kindly advise? Thanks.
I have the following dataframe and I would need to find the sequential invoice from each same name. Can kindly advise? Thanks.
data={'myid':[1,2,3,4,5,6],'name':['Mary','John','John','Peh','Alex','ken'],'invoice':['INV001','INV003','INV004','INV007','GAA002','INV008']} df=pd.DataFrame(data) dfThe following are the result. John has squential invoice of INV003 and INV004. INV007 and INV008 although is sequential but was not from same person.
result={'myid':[2,3],'name':['John','John'],'invoice':['INV003','INV004']} df_result=pd.DataFrame(result) df_result