Last active
January 3, 2024 22:36
-
-
Save karamanbk/314d3d5483b9be1d2cc7f9694368f3bc 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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from datetime import datetime, timedelta\n", | |
"import pandas as pd\n", | |
"%matplotlib inline\n", | |
"import matplotlib.pyplot as plt\n", | |
"import numpy as np\n", | |
"import seaborn as sns\n", | |
"\n", | |
"\n", | |
"import plotly.offline as pyoff\n", | |
"import plotly.graph_objs as go" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
" <script type=\"text/javascript\">\n", | |
" window.PlotlyConfig = {MathJaxConfig: 'local'};\n", | |
" if (window.MathJax) {MathJax.Hub.Config({SVG: {font: \"STIX-Web\"}});}\n", | |
" if (typeof require !== 'undefined') {\n", | |
" require.undef(\"plotly\");\n", | |
" define('plotly', function(require, exports, module) {\n", | |
" /**\n", | |
"* plotly.js v1.53.0\n", | |
"* Copyright 2012-2020, Plotly, Inc.\n", | |
"* All rights reserved.\n", | |
"* Licensed under the MIT license\n", | |
"*/\n", |
Hi Baris,
Thank you so much for this wonderful report!
I was wondering why I am getting such error for:
Line Number 95
total_user_count = tx_retention[tx_retention.MinPurchaseYearMonth == selected_month].MinPurchaseYearMonth.count()
error:
AttributeError: 'DataFrame' object has no attribute 'MinPurchaseYearMonth'
Thanks in advance,
Jeanet.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Barış, thanks for the code it is very helpful for me.
I am not getting right the Monthly Order Count of orders in my df. So I think there ir a mistake in the code, look:
In [28]:
tx_monthly_sales = tx_uk.groupby('InvoiceYearMonth')['Quantity'].sum().reset_index()
you are adding all the qty of products sold.Also, look a the output table the # of transactions says 298,101 which is more than your whole df.
Unless you mean this table is the total count of the # of products sold, which I think it's the value that we obtained.
Also the monthly order average, I would way that it should say that is the average price of the product per month because the value obtained is not taking into account the whole transaction but each product and obtains the mean.
In [33]:
tx_monthly_order_avg = tx_uk.groupby('InvoiceYearMonth')['Revenue'].mean().reset_index()
I am new with python so, I really have no idea how to obatin the average revenue per order and the total number of orders, ja!
Please let me know your comments, probably I am just confused.
Thank you again for this analysis, it's pretty good.