24

How Analytics Can Help Business

 4 years ago
source link: https://www.tuicool.com/articles/aaIVjmI
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

RzeaQr6.png!web

How Analytics Can Help Businesses

The purpose of this article is to explain how to use Python in a simple way to help your company’s growth .

If you would like to use this method yourself, you can access my code at my github . All you need is a basic knowledge of Python and Pandas .

You can find the data I’ll be using at Kaggle online retail data .

The first step to understand the data in hand is to understand how the different variables interact between each other.

As usual we need to use pandas to read the data from CSV:

e2eeAra.png!web

As you can observe above we have limited features, however we can create features from the available ones using math and statistics.

The available features we are going to use are:

Quantity
InvoiceDate
UnitPrice
CustomerID
Country

And from these features we are going to create:

Revenue
Percentage Growth
User Type( new and existing customers)
Retention Rate

Cleaning the Data:

After removing NULL and duplicate values, narrowing down to only UK data (because it has the most records), removing month of December 2011(because data in December is incomplete), and changing the ‘InvoiceDate’ object into DateTime, we are down to this:

ErAVVvU.png!web

Now our data is down from 541909 rows and 8 columns to 349227 rows and 9 columns. We need to be careful when we remove NULL and duplicate values because we do not want to lose too many data, but since we have enough data here we can afford losing some.

Now that we cleaned the data, it is time to write down clear and objective KPI s which is different based on each business’s objective. For the purpose of this article, I decided to pick total revenue monthly as a KPI. Let’s calculate monthly revenue.

Monthly Revenue:

Revenue = UnitPrice * Quantity

Use pandas to find revenue for each month.

NnQFVzY.png!web

And now the fun part, I use Plotly to visualize the data.

Yz6Brqn.png!web

As you can see above the revenue went up from August 2011 onward. However February and April shows negative trend.

It is also useful to calculate the monthly growth , you can find it below.

IfQvEbZ.png!web

67rieuF.png!web

The graph above shows that the revenue went up by almost 19% in November 2011, the most growth happened in September by almost 60%. As we‘ve seen before, the growth went down in February and April. Let’s evaluate more to understand more about the data.

Monthly Order Count:

We use the same method that we used to find monthly revenue in order to find monthly order count.

vyeEz2f.png!web

nqaIJzR.png!web

As we expected, the monthly order count went down in February (from 277k to 212k) and April (from 275k to 259k). But the monthly order went up to 580k for the month of November.

All the metrics that we have evaluated so far went down in February and April. This is a time to review your business and find out why the revenue went down, Is it due to less active customers or customers ordered less? or many other reasons…we should continue investigating some other important metrics such as new and existing customers in order to understand the data more and to be able to evaluate retention rate .

New Customers:

Who are new customers? For each business this can answer differently, for the purpose of this article, I define new customers as a customer that never did a purchase before. Therefore, I use .min() function to find the first time customers purchased.

FjmQfqq.png!web

Existing Customers:

Ejeymma.png!web

Now that we calculated new and existing customers, we evaluate revenue per month based on existing and new customers.

22IFJ3U.png!web

Existing customers show a positive trends and the business has more existing customers than new customers.

As always a good visualization makes analysis more fun and thanks to Plotly we can make pretty graph.

IRvmUvV.png!web

It seems that the business acquired new customers on January 2011, however as the year go the number of new customers shows negative trend. Again, this is a time to review your KPIs and see if you are on track and if needs to change the target, and ask question such as: is the business acquired new customers on the beginning of 2011 due to huge promotion, or new products? And why the business failed to acquired more new customers?

Now we have enough information to evaluate retention rate .

Retention Rate:

Customer retention rate designates the percentage of customers the company has retained over a given time period. Retention rate is a reverse side of churn rate , which shows the percentage of customers a company has lost over a specific period.

Pandas offers several options for grouping and summarizing data, for the purpose of this article I use crosstab function which builds a cross-tabulation table that can show the frequency with which certain groups of data appear. Number 1 in the below table indicates that the customer is active on that month, and 0 indicates that the customers did not purchase for that month.

euAf6jF.png!web

With the help of Python, we can calculate retention rate by calculating the number of retained customers from previous month and the number of total customers.

AZfqyea.png!web

ZRRFnyF.png!web

We can see that only 37% of customers were retained on November 2011.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK