'How To Find New Business MRR From Existing MRR in Pandas

Current Code is whole MRR but How to find New Business MRR

cnts=[]
dat =[]
tp = []
mnth = []
for i in date_range:
    df3 = df[(df.TotalPrice > 0) & (df.MemTerminationDate > i) & (df.MemStartDate <= i)]
    cnts.append(df3.Id.count())
    dat.append(i)
    mnth.append(i.strftime('%B'))
    tp.append(df3.TotalPrice.sum())
df2 = pd.DataFrame()
df2["MemCounts"]=cnts
df2["ActMemDate"]=dat
df2["Month"]=mnth
df2["TotalPrice"]=tp

I want only New Business MRR count(For those members who are new and taken only 1 membership)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source