Created
March 12, 2020 17:45
-
-
Save aniruddha27/81d5357f0e98162b1ad1007ec1e136fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#new revenue column | |
df['revenue'] = df.apply(lambda x: x.checkout_price*x.num_orders,axis=1) | |
#new month column | |
df['month'] = df['week'].apply(lambda x: x//4) | |
#list to store month-wise revenue | |
month=[] | |
month_order=[] | |
for i in range(max(df['month'])): | |
month.append(i) | |
month_order.append(df[df['month']==i].revenue.sum()) | |
#list to store week-wise revenue | |
week=[] | |
week_order=[] | |
for i in range(max(df['week'])): | |
week.append(i) | |
week_order.append(df[df['week']==i].revenue.sum()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment