Netflix Users Analysis Using Python-1
Netflix Users Analysis Using Python-1
📝 Project Description:
Leveraging the power of Python and cutting-edge data analysis libraries, we delved into a fascinating
dataset on Netflix users to uncover valuable insights. Explored key attributes such as Age, Gender,
Subscription Plan, Monthly Revenue, Last Date of Activity, Join Date, and Device to gain a
comprehensive understanding of user behavior and preferences. Employed advanced data visualization
techniques to present findings in an insightful and visually appealing manner. Conducted in-depth
analysis to identify trends, patterns, and correlations within the dataset, providing actionable insights for
Netflix and related stakeholders.
Import Library
In [1]: import pandas as pd
Data Preprocessing
.head()
head is used show to the By default = 5 rows in the dataset
In [4]: df.head()
Out[4]:
Last
User Subscription Monthly Join Plan
Payment Country Age Gender Device
ID Type Revenue Date Duration
Date
15- United
0 1 Basic 10 10-06-23 28 Male Smartphone 1 Month
01-22 States
05-
1 2 Premium 15 22-06-23 Canada 35 Female Tablet 1 Month
09-21
28- United
2 3 Standard 12 27-06-23 42 Male Smart TV 1 Month
02-23 Kingdom
10-
3 4 Standard 12 26-06-23 Australia 51 Female Laptop 1 Month
07-22
01-
4 5 Basic 10 28-06-23 Germany 33 Male Smartphone 1 Month
05-23
.tail()
tail is used to show last rows
In [5]: df.tail()
Out[5]:
Last
User Subscription Monthly Join Plan
Payment Country Age Gender Device
ID Type Revenue Date Duration
Date
25- Smart
2495 2496 Premium 14 12-07-23 Spain 28 Female 1 Month
07-22 TV
04- Smart
2496 2497 Basic 15 14-07-23 Spain 33 Female 1 Month
08-22 TV
09- United
2497 2498 Standard 12 15-07-23 38 Male Laptop 1 Month
08-22 States
12-
2498 2499 Standard 13 12-07-23 Canada 48 Female Tablet 1 Month
08-22
.shape
It show the total no of rows & Column in the dataset
In [6]: df.shape
.Columns
It show the no of each Column
In [7]: df.columns
.dtypes
This Attribute show the data type of each column
In [8]: df.dtypes
.unique()
In a column, It show the unique value of specific column.
In [9]: df["Country"].unique()
.nuique()
It will show the total no of unque value from whole data frame
In [10]: df.nunique()
.describe()
It show the Count, mean , median etc
In [11]: df.describe()
Out[11]:
User ID Monthly Revenue Age
.value_counts
It Shows all the unique values with their count
In [12]: df["Country"].value_counts()
In [13]: df.isnull()
Out[13]:
Last
User Subscription Monthly Join Plan
Payment Country Age Gender Device
ID Type Revenue Date Duration
Date
0 False False False False False False False False False False
1 False False False False False False False False False False
2 False False False False False False False False False False
3 False False False False False False False False False False
4 False False False False False False False False False False
... ... ... ... ... ... ... ... ... ... ...
2495 False False False False False False False False False False
2496 False False False False False False False False False False
2497 False False False False False False False False False False
2498 False False False False False False False False False False
2499 False False False False False False False False False False
In [14]: sns.heatmap(df.isnull())
Out[14]: <AxesSubplot:>
In [15]: df["Join Date"] = pd.to_datetime(df["Join Date"])
df["Last Payment Date"] = pd.to_datetime(df["Last Payment Date"])
User ID Subscription Type Monthly Revenue Join Date Last Payment Date \
0 1 Basic 10 2022-01-15 2023-10-06
1 2 Premium 15 2021-05-09 2023-06-22
2 3 Standard 12 2023-02-28 2023-06-27
3 4 Standard 12 2022-10-07 2023-06-26
4 5 Basic 10 2023-01-05 2023-06-28
... ... ... ... ... ...
2495 2496 Premium 14 2022-07-25 2023-12-07
2496 2497 Basic 15 2022-04-08 2023-07-14
2497 2498 Standard 12 2022-09-08 2023-07-15
2498 2499 Standard 13 2022-12-08 2023-12-07
2499 2500 Basic 15 2022-08-13 2023-12-07
This library can help you find the continent of a given country
In [17]: # Deriving some useful features using lambda function
def get_continent(country):
"""returns the continent of the given country"""
Out[18]:
Last
User Subscription Monthly Join Plan
Payment Country Age Gender Device
ID Type Revenue Date Duration
Date
2023- 2023-06-
2 3 Standard 12 Europe Senior Male Smart TV 1 Month Fe
02-28 27
2022- 2023-06-
3 4 Standard 12 Australia Senior Female Laptop 1 Month O
10-07 26
2023- 2023-06-
4 5 Basic 10 Europe Young Male Smartphone 1 Month Ja
01-05 28
... ... ... ... ... ... ... ... ... ... ...
2022- 2023-12-
2495 2496 Premium 14 Europe Young Female Smart TV 1 Month
07-25 07
2022- 2023-07-
2496 2497 Basic 15 Europe Young Female Smart TV 1 Month
04-08 14
Out[26]:
Last
User Subscription Monthly Join Plan
Payment Country Age Gender Device
ID Type Revenue Date Duration
Date
2023- 2023-06-
2 3 Standard 12 Europe Senior Male Smart TV 1 Month Fe
02-28 27
2022- 2023-06-
3 4 Standard 12 Australia Senior Female Laptop 1 Month O
10-07 26
2023- 2023-06-
4 5 Basic 10 Europe Young Male Smartphone 1 Month Ja
01-05 28
... ... ... ... ... ... ... ... ... ... ...
2022- 2023-12-
2495 2496 Premium 14 Europe Young Female Smart TV 1 Month
07-25 07
2022- 2023-07-
2496 2497 Basic 15 Europe Young Female Smart TV 1 Month
04-08 14