This report analyzes the Netflix Movies and TV Shows dataset using exploratory data analysis and visualization techniques.
dat <- read_csv("netflix_titles.csv")
dat$date_added <- mdy(dat$date_added)
dat$year_added <- year(dat$date_added)
dat$month_added <- month(dat$date_added, label = TRUE)
dat$duration_num <- parse_number(dat$duration)
head(dat)
## # A tibble: 6 × 15
## show_id type title director cast country date_added release_year rating
## <chr> <chr> <chr> <chr> <chr> <chr> <date> <dbl> <chr>
## 1 s1 Movie Dick Jo… Kirsten… <NA> United… 2021-09-25 2020 PG-13
## 2 s2 TV Show Blood &… <NA> Ama … South … 2021-09-24 2021 TV-MA
## 3 s3 TV Show Ganglan… Julien … Sami… <NA> 2021-09-24 2021 TV-MA
## 4 s4 TV Show Jailbir… <NA> <NA> <NA> 2021-09-24 2021 TV-MA
## 5 s5 TV Show Kota Fa… <NA> Mayu… India 2021-09-24 2021 TV-MA
## 6 s6 TV Show Midnigh… Mike Fl… Kate… <NA> 2021-09-24 2021 TV-MA
## # ℹ 6 more variables: duration <chr>, listed_in <chr>, description <chr>,
## # year_added <dbl>, month_added <ord>, duration_num <dbl>
summary(dat)
## show_id type title director
## Length :8807 Length :8807 Length :8807 Length :8807
## N.unique :8807 N.unique : 2 N.unique :8807 N.unique :4528
## N.blank : 0 N.blank : 0 N.blank : 0 N.blank : 0
## Min.nchar: 2 Min.nchar: 5 Min.nchar: 1 Min.nchar: 2
## Max.nchar: 5 Max.nchar: 7 Max.nchar: 104 Max.nchar: 208
## NAs :2634
##
## cast country date_added release_year
## Length :8807 Length :8807 Min. :2008-01-01 Min. :1925
## N.unique :7692 N.unique : 748 1st Qu.:2018-04-06 1st Qu.:2013
## N.blank : 0 N.blank : 0 Median :2019-07-02 Median :2017
## Min.nchar: 3 Min.nchar: 4 Mean :2019-05-17 Mean :2014
## Max.nchar: 771 Max.nchar: 123 3rd Qu.:2020-08-19 3rd Qu.:2019
## NAs : 825 NAs : 831 Max. :2021-09-25 Max. :2021
## NAs :10
## rating duration listed_in description
## Length :8807 Length :8807 Length :8807 Length :8807
## N.unique : 17 N.unique : 220 N.unique : 514 N.unique :8775
## N.blank : 0 N.blank : 0 N.blank : 0 N.blank : 0
## Min.nchar: 1 Min.nchar: 5 Min.nchar: 6 Min.nchar: 61
## Max.nchar: 8 Max.nchar: 10 Max.nchar: 79 Max.nchar: 248
## NAs : 4 NAs : 3
##
## year_added month_added duration_num
## Min. :2008 Jul : 827 Min. : 1.00
## 1st Qu.:2018 Dec : 813 1st Qu.: 2.00
## Median :2019 Sep : 770 Median : 88.00
## Mean :2019 Apr : 764 Mean : 69.85
## 3rd Qu.:2020 Oct : 760 3rd Qu.:106.00
## Max. :2021 (Other):4863 Max. :312.00
## NAs :10 NAs : 10 NAs :3
ggplot(dat, aes(type)) +
geom_bar(fill="steelblue") +
labs(
title="Distribution of Netflix Content",
x="Content Type",
y="Number of Titles"
) +
theme_minimal()
country_data <- dat %>%
separate_rows(country, sep=",") %>%
mutate(country=str_trim(country)) %>%
count(country, sort=TRUE) %>%
slice(1:10)
ggplot(country_data,
aes(reorder(country,n), n))+
geom_col(fill="tomato")+
coord_flip()+
labs(
title="Top 10 Countries Producing Netflix Content",
x="Country",
y="Titles")+
theme_minimal()
year_data <- dat %>%
count(year_added)
ggplot(year_data,
aes(year_added,n))+
geom_line(color="blue")+
geom_point(size=2)+
labs(
title="Netflix Content Added by Year",
x="Year",
y="Titles")+
theme_minimal()
ggplot(dat,
aes(rating))+
geom_bar(fill="darkgreen")+
coord_flip()+
labs(
title="Distribution of Content Ratings",
x="Rating",
y="Count")+
theme_minimal()
ggplot(filter(dat,type=="Movie"),
aes(duration_num))+
geom_histogram(bins=30,
fill="orange",
color="white")+
labs(
title="Movie Duration Distribution",
x="Duration (Minutes)",
y="Frequency")+
theme_minimal()
heat_data <- dat %>%
count(year_added,month_added)
ggplot(heat_data,
aes(month_added,
factor(year_added),
fill=n))+
geom_tile()+
labs(
title="Heatmap of Content Added",
x="Month",
y="Year")+
theme_minimal()
genre_data <- dat %>%
separate_rows(listed_in,sep=",") %>%
mutate(listed_in=str_trim(listed_in)) %>%
count(type,listed_in,sort=TRUE) %>%
group_by(type) %>%
slice_max(n,n=10)
ggplot(genre_data,
aes(reorder(listed_in,n),
n,
fill=type))+
geom_col()+
coord_flip()+
labs(
title="Top Genres by Content Type",
x="Genre",
y="Titles")+
theme_minimal()
plot_ly(
data=dat,
x=~release_year,
y=~duration_num,
type="scatter",
mode="markers",
color=~type,
text=~title
)
This report demonstrates exploratory analysis of the Netflix dataset through eight visualizations, including an interactive Plotly chart. The graphics reveal trends in content types, production countries, release patterns, ratings, genres, and duration distributions.