Moving on, right after processing the data, it is necessary to shape it according to the proposed analysis to be carried out. I decided that the analysis would revolve around the following proposal:
Find the total revenue;
Find the average amount spent by customers;
Select purchases over a thousand dollars, so that discount coupons are sent for the respective customers' next purchases.
To do this, we will manipulate the data once again:
Where only a sum of the values contained in the “purchase_dollars” column was performed, using the sum() method .
In this case, the average of the column values was calculated using the mean() method .
Now, filtering the column values for purchases over a thousand dollars:
In this step, you simply assign the original data frame 's filter to a new data frame , selecting only values greater than or equal to one thousand.
Note that the table now no longer contains a thousand rows, but only 489. This confirms that the filter was indeed applied. Another point to note is that the index was taken out of order, since rows were deleted in the process. If you wish, you can reset the index value so that it is sorted again.
Here, we apply the reset_index() method to the filtered data frame , russia number data setting the arguments drop = True and inplace = True so that the column with the old index is discarded. Thus, at this stage the Python code for this project is finished.
ANALYSIS SUMMARY
Considering what was proposed for this analysis, it was possible to conclude that:
Total revenue from the thousand purchases was $988,359.2
The average purchase value was: $988.35
489 customers made purchases over $1000
Regarding customers eligible to receive a discount coupon for their next purchase, the next step would be, for example, to automate an email to be sent to these customers, containing the discount coupon.
Unfortunately, I have not yet reached this level of Python programming, and I was limited to just analyzing the data in this project. However, it could be an aspect to be exercised and perhaps presented in a future project.
In this way, I believe it was possible to present my final project and briefly demonstrate how Python programming can be easy and intuitive, as well as agile when programming, since with just a few lines of code it is possible to perform interesting analyses for a set of data. Big hug!
What did we learn from this article?
What do they say about python?
There has been a lot of talk about the programming language “of the moment” in recent times. Easy, intuitive, powerful: these are just some of the adjectives found to describe the Python language and its numerous features, in the face of a visible growth in its use.
What can we learn in the python course at harve?
During the course we learn everything from the most basic things - such as installing Python on your machine or basic concepts of programming logic - to slightly more complex subjects, such as web development, for example.
What library is used in this project?
As a final project of the course, I decided to carry out a brief data analysis using the Pandas library.
What is the Mockaroo website?
The website mockaroo.com is an API that generates random data in different file formats, including CSV format.
What does the df.info() command in pandas do?
This command is a Pandas method that displays information about the data frame object, including the size of the data frame, the data type of each column, null values, and memory used.
What is the purpose of this analysis?
Find the total revenue; Find the average amount spent by customers; Select purchases over a thousand dollars, so that discount coupons can be sent for the respective customers' next purchases.
Digital Marketing: building a digital relationship
-
- Posts: 18
- Joined: Thu Dec 05, 2024 5:23 am