├── total viewership hours by language.jpg
├── total viewership hours by content type.jpg
├── total viewership hours by release months.jpg
├── total viewership hours by release season.jpg
├── weekly release patters and viewership hours.jpg
├── monthly release patterns and viewership hours.jpg
├── viewership trends by content types and release month.jpg
├── CONTRIBUTING.md
├── LICENSE
├── README.md
└── NF analysis.ipynb
/total viewership hours by language.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/total viewership hours by language.jpg
--------------------------------------------------------------------------------
/total viewership hours by content type.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/total viewership hours by content type.jpg
--------------------------------------------------------------------------------
/total viewership hours by release months.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/total viewership hours by release months.jpg
--------------------------------------------------------------------------------
/total viewership hours by release season.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/total viewership hours by release season.jpg
--------------------------------------------------------------------------------
/weekly release patters and viewership hours.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/weekly release patters and viewership hours.jpg
--------------------------------------------------------------------------------
/monthly release patterns and viewership hours.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/monthly release patterns and viewership hours.jpg
--------------------------------------------------------------------------------
/viewership trends by content types and release month.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DavieObi/Netflix-Content-Strategy-Analysis/HEAD/viewership trends by content types and release month.jpg
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | ```markdown
2 | # Contributing to Netflix Content Strategy Analysis
3 |
4 | Thank you for your interest in contributing to this project! We welcome contributions that improve the functionality, performance, and usability of the analysis.
5 |
6 | ## How to Contribute
7 |
8 | 1. Fork the repository.
9 | 2. Create a new branch for your feature or bug fix.
10 | 3. Make your changes and commit them with descriptive messages.
11 | 4. Push your changes to your forked repository.
12 | 5. Submit a pull request detailing your changes.
13 |
14 | Please ensure that your contributions adhere to the project's coding standards and include appropriate tests where applicable.
15 |
16 | ## Code of Conduct
17 |
18 | By participating in this project, you agree to abide by our Code of Conduct. Let's keep the community respectful and welcoming for all.
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2025 DavieObi
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Netflix Content Strategy Analysis (2023)
2 |
3 | ## Project Overview
4 |
5 | This project delves into Netflix's viewership data for 2023 to uncover key trends and patterns that can inform content acquisition, production, and release strategies. By analyzing metrics such as "Hours Viewed" across different content types, languages, and release timings, this analysis aims to provide actionable insights for optimizing content performance and maximizing subscriber engagement.
6 |
7 | ## Problem Statement
8 |
9 | In an increasingly competitive streaming landscape, understanding audience preferences and viewing behaviors is paramount for platforms like Netflix. The challenge is to identify which types of content, languages, and release schedules drive the most engagement and viewership hours, allowing for data-driven decisions that enhance content strategy and return on investment.
10 |
11 | ## Project Objective
12 |
13 | The primary objectives of this analysis are to:
14 |
15 | 1. **Clean and preprocess** raw viewership data to enable robust analysis.
16 | 2. **Identify dominant content types** (Shows vs. Movies) in terms of total viewership hours.
17 | 3. **Uncover key language preferences** among the global audience.
18 | 4. **Analyze the impact of release timing** (monthly, weekly, and seasonal) on content viewership.
19 | 5. **Pinpoint top-performing titles** based on total hours viewed.
20 | 6. **Provide actionable insights** to guide Netflix's future content strategy, optimizing for maximum audience engagement and retention.
21 |
22 | ## Column Dictionary
23 |
24 | | Column Name | Description | Data Type |
25 | | :----------------- | :-------------------------------------------------------------------------- | :--------- |
26 | | `Title` | The name of the content (Show or Movie). | String |
27 | | `Hours Viewed` | The total number of hours the content was viewed. Initially, this might be a string with commas. | Float |
28 | | `Content Type` | Categorization of the content as either 'Show' or 'Movie'. | String |
29 | | `Language Indicator` | The primary language of the content. | String |
30 | | `Release Date` | The date the content was released on Netflix. | Datetime |
31 |
32 | ## Analysis and Insights
33 |
34 | The analysis proceeded through several key stages, each yielding valuable insights:
35 |
36 | ### 1\. Data Cleaning and Preprocessing
37 |
38 | The initial step involved cleaning the "Hours Viewed" column by removing commas and converting it to a float data type, essential for numerical computations.
39 |
40 | ### 2\. Viewership by Content Type
41 |
42 | This analysis aggregated total viewership hours by 'Content Type' (Shows vs. Movies).
43 |
44 | 
45 |
46 | **Insights:**
47 |
48 | * **Dominance of Shows**: It's clear that 'Shows' account for a significantly higher number of total viewership hours compared to 'Movies'. The bar for 'Shows' is considerably taller, indicating that audiences spend much more time watching series content on Netflix.
49 | * **Content Strategy Implication**: This trend suggests that Netflix's strategy of investing heavily in original series and multi-season shows is paying off in terms of engagement and total hours watched. It indicates that viewers are more likely to binge-watch or repeatedly engage with episodic content.
50 | * **Potential Areas for Review**: While shows are dominating, it might be valuable for Netflix to further analyze movie viewership. Depending on the goals, they might want to explore if there are specific movie genres or types that perform better, or if there's an opportunity to boost movie engagement.
51 |
52 | ### 3\. Viewership by Language
53 |
54 | This section aggregated total viewership hours by 'Language Indicator'.
55 |
56 | 
57 |
58 | **Insights:**
59 |
60 | * **English Dominance**: English content overwhelmingly leads in total viewership hours. This is expected given Netflix's global reach and the widespread use of English. It suggests that English content remains a primary driver of engagement on the platform.
61 | * **Significant Non-English Viewership**: While English is dominant, other languages, particularly Spanish and Korean, show very substantial viewership. This highlights the growing importance of non-English original content and the global appeal of shows and movies from diverse linguistic backgrounds.
62 | * **Strategic Importance of Key Non-English Markets**: The strong performance of content in languages like Spanish and Korean (likely driven by hits from Latin America and South Korea) indicates successful localization and content acquisition strategies in these regions. It validates Netflix's investment in producing or acquiring content in these languages.
63 | * **Diversification of Content**: The presence of viewership from various other languages, even if smaller in magnitude compared to the top three, signifies Netflix's diverse content library and its ability to cater to a wide range of linguistic preferences globally.
64 |
65 | ### 4\. Viewership Trends by Release Month
66 |
67 | This analysis explored how total viewership hours for newly released content vary by release month.
68 |
69 | 
70 |
71 | **Insights:**
72 |
73 | * **Significant March Peak:** The most prominent insight is the massive surge in total viewership hours for content released in **March**, far surpassing any other month. This indicates that content released during this month garnered exceptionally high engagement. This could be due to the release of major tentpole series or films during this period, or perhaps a reflection of specific audience viewing habits during early spring.
74 | * **Strong Performance in Early Q1:** Beyond March, content released in **January, February, and April** also shows consistently high viewership hours, although not as high as March. This suggests that the first quarter of the year is generally a very strong period for new content releases on Netflix in terms of attracting total watch time.
75 | * **Mid-Year Decline:** There's a noticeable and sustained drop in total viewership hours for content released during the **middle of the year (roughly May through September)**. This period shows significantly lower engagement for new releases compared to the early months. This seasonal dip might correlate with warmer weather in many regions, leading to more outdoor activities and less indoor screen time.
76 | * **Year-End Recovery:** Viewership hours for content released towards the **end of the year (October, November, December)** show a recovery trend from the mid-year slump, gradually increasing. While not reaching the peak levels of Q1, these months still contribute substantial viewership, possibly influenced by holiday seasons and colder weather driving more indoor entertainment.
77 | * **Strategic Release Implications:** The plot strongly suggests that the **timing of content release is a critical factor** in its overall viewership performance. Netflix appears to benefit significantly from releases in Q1, particularly March, and may need to consider strategies to either boost engagement for mid-year releases or save its biggest titles for peak viewership periods.
78 |
79 | ### 5\. Top 5 Titles by Viewership Hours
80 |
81 | This section identified the individual titles that garnered the most viewership hours.
82 |
83 |
84 | | Title | Hours Viewed | Language Indicator | Content Type | Release Date |
85 | | :---------------------------------------- | :----------- | :----------------- | :----------- | :----------- |
86 | | The Night Agent: Season 1 | 812100000.0 | English | Show | 2023-03-23 |
87 | | Ginny & Georgia: Season 2 | 665100000.0 | English | Show | 2023-01-05 |
88 | | King the Land: Limited Series // 킹더랜드: 리미티드 시리즈 | 630200000.0 | Korean | Movie | 2023-06-17 |
89 | | The Glory: Season 1 // 더 글로리: 시즌 1 | 622800000.0 | Korean | Show | 2022-12-30 |
90 | | ONE PIECE: Season 1 | 541900000.0 | English | Show | 2023-08-31 |
91 |
92 | **Insights:**
93 |
94 | * **Dominance of Shows:** Four out of the top five titles are "Shows," reinforcing the earlier insight that series content drives significantly more total viewership hours on Netflix compared to movies. This highlights the binge-watching appeal and sustained engagement that episodic content provides.
95 | * **English Content Leads:** Three of the top five titles are in English, including the top two. This confirms the strong global appeal and viewership of English-language content.
96 | * **Strong Performance of Korean Content:** Two titles, "King the Land" and "The Glory," are Korean. This further emphasizes the global phenomenon of K-dramas and their massive impact on Netflix's viewership, showcasing the success of Netflix's investment in non-English original content, especially from South Korea.
97 | * **Recency of Release:** Most of these top titles were released relatively recently, primarily in 2023. "The Glory: Season 1" was released in late 2022, but its continued presence here indicates strong sustained viewership into 2023. This suggests that recent hits significantly contribute to overall viewership figures.
98 |
99 | ### 6\. Viewership Trends by Content Types and Release Month
100 |
101 | This plot broke down monthly viewership trends by content type and release month.
102 |
103 | 
104 |
105 | **Insights:**
106 |
107 | * **Shows Drive Overall Trends:** The viewership trend for "Shows" closely mirrors the overall "Total Viewership Hours by Release Month" plot. Shows consistently account for the vast majority of viewership hours across all months, clearly driving the observed peaks (especially in March) and dips.
108 | * **Consistent Dominance of Shows:** Shows maintain a significantly higher viewership level than movies in every single release month. Even during months where overall viewership dips, shows still command a much larger share of hours viewed than movies at their peak.
109 | * **Shared Seasonal Pattern:** Both "Movies" and "Shows" exhibit a similar seasonal pattern based on their release months: a strong peak in **March**, a general decline during **mid-year (May to September)**, and a moderate recovery towards the **end of the year (October to December)**.
110 | * **Strategic Implications for Release:** This further reinforces that Q1, particularly March, is a prime window for releasing content, especially shows, to maximize viewership. While movies follow the same pattern, their overall contribution is much smaller.
111 |
112 | ### 7\. Total Viewership Hours by Release Season
113 |
114 | This plot aggregated viewership hours by traditional seasons (Spring, Summer, Autumn, Winter).
115 |
116 | 
117 |
118 | **Insights:**
119 |
120 | * **Spring is the Undisputed Champion:** Content released during the **Spring** season (which would include March, our previously identified peak month) generates by far the highest total viewership hours. This suggests that Spring is a critical period for Netflix to launch its most anticipated or high-impact content.
121 | * **Clear Seasonal Preference:** There's a distinct hierarchy in viewership based on release season: **Spring \> Winter \> Autumn \> Summer**. This clearly indicates that certain times of the year are more conducive to attracting high viewership for new releases.
122 | * **Summer Slump Confirmed:** The plot strongly reinforces the earlier observation of a mid-year dip, with **Summer** showing the lowest total viewership hours for content released during that period. This aligns with people spending more time outdoors during warmer months.
123 | * **Winter's Strong Showing:** **Winter** also proves to be a very strong season for viewership, coming in second after Spring. This could be influenced by holiday viewing habits and colder weather keeping audiences indoors.
124 | * **Strategic Release Timing is Key:** This seasonal breakdown provides a clear strategic directive for Netflix: Prioritize major, high-budget, or highly anticipated releases for **Spring** and **Winter**, and consider the lower viewership potential for content released in **Summer**.
125 |
126 | ### 8\. Monthly Release Patterns and Viewership Hours
127 |
128 | This plot compared the number of releases in a month against the total viewership hours generated by content released in that month.
129 |
130 | 
131 |
132 | **Insights:**
133 |
134 | * **Viewership Peaks Independently of Release Volume:** The most striking observation is that the month with the highest viewership hours (March) does not necessarily correspond to the month with the highest number of releases. This suggests that it's not simply the *number* of new titles released that drives total viewership hours.
135 | * **Quality/Anticipation Over Sheer Quantity:** The data implies that the *impact*, *quality*, or *anticipation* surrounding specific titles released in months like March plays a more significant role in generating high viewership. Netflix might be strategically scheduling its most popular or heavily marketed content for these peak periods.
136 | * **Mid-Year Dip Remains Consistent:** The dip in total viewership hours during the mid-year months (roughly May to August) is consistent, even as the number of releases might vary. This further supports the idea that seasonal audience viewing habits, rather than just release volume, influence overall engagement for new content.
137 | * **Strategic Release Timing Validated:** The lack of a direct, linear correlation between release count and viewership hours reinforces the importance of strategic release timing.
138 |
139 | ### 9\. Weekly Release Patterns and Viewership Hours
140 |
141 | This plot provided a granular view of weekly release patterns and corresponding viewership hours.
142 |
143 | 
144 |
145 | **Insights:**
146 |
147 | * **Precise Peak Viewership Window:** The plot strongly confirms and refines previous observations: the absolute peak in total viewership hours for newly released content occurs around **Week 12-13** (corresponding to late March). This highlights a very specific and highly effective window for content releases on Netflix.
148 | * **No Direct Weekly Quantity-Viewership Correlation:** Similar to the monthly analysis, there isn't a direct linear relationship between the number of releases in a given week and the total viewership hours generated.
149 | * **Strategic Tentpole Releases:** The concentrated spikes in viewership during certain weeks (especially Week 12-13, and earlier in Q1) suggest that Netflix is strategically deploying its most anticipated and high-budget content during these periods to capture maximum audience attention.
150 | * **Sustained Mid-Year Slump:** The period from roughly Week 20 through Week 35 (corresponding to summer months) consistently shows lower viewership hours for newly released content. This weekly view further solidifies the seasonal dip observed at monthly and quarterly levels.
151 | * **Actionable Scheduling Insights:** This weekly breakdown offers the most granular data for content scheduling, identifying specific "power weeks" where content performs exceptionally well.
152 |
153 | ### 10\. Content Releases Around Significant Holidays
154 |
155 | This section examined the viewership of content released within a 3-day window of defined significant holidays.
156 |
157 | | Title | Release Date | Hours Viewed |
158 | | :--------------------------------------------- | :----------- | :----------- |
159 | | The Glory: Season 1 // 더 글로리: 시즌 1 | 2022-12-30 | 622800000.0 |
160 | | La Reina del Sur: Season 3 | 2022-12-30 | 429600000.0 |
161 | | Kaleidoscope: Limited Series | 2023-01-01 | 252500000.0 |
162 | | Perfect Match: Season 1 | 2023-02-14 | 176800000.0 |
163 | | ... | ... | ... |
164 |
165 | **Insights:**
166 |
167 | * **Strategic Holiday Releases with High Viewership:** Several top-performing titles, such as "The Glory: Season 1" and "Kaleidoscope: Limited Series," were released very close to New Year's (December 30-31, 2022, or January 1, 2023). This indicates a strategic move by Netflix to capitalize on holiday downtime, when audiences are likely to have more leisure time.
168 | * **Valentine's Day Releases:** "Perfect Match: Season 1" was released around Valentine's Day and shows substantial viewership, suggesting that romance-themed content around this period can be successful.
169 | * **Mixed Performance for Holiday-Adjacent Content:** While some holiday releases achieve massive success, the list also includes titles with much lower viewership hours. This highlights that simply releasing content near a holiday is not a guarantee of high viewership; the content's inherent appeal, marketing, and genre fit are still paramount.
170 | * **Focus on Q4/Q1 Holidays:** The data prominently features releases around New Year's and Valentine's Day, suggesting Netflix might concentrate its high-impact holiday releases around the Q4/Q1 transition.
171 |
172 | ## Conclusion
173 |
174 | This Netflix content strategy analysis for 2023 provides robust evidence for several key strategic directions:
175 |
176 | 1. **Shows are the Primary Engagement Driver:** Episodic content consistently outperforms movies in terms of total hours viewed, suggesting that Netflix's continued investment in high-quality series and multi-season shows is highly effective for driving sustained audience engagement.
177 | 2. **Global Content Appeal with Strong Non-English Performance:** While English content remains dominant, the significant viewership of titles in languages like Korean and Spanish underscores the success of Netflix's international content strategy and the growing global appetite for diverse narratives. Investing in and promoting non-English originals is crucial for continued growth.
178 | 3. **Release Timing is Critical for Maximizing Viewership:** The analysis clearly identifies **March (specifically Weeks 12-13)** and the broader **Spring** season as prime windows for launching new content, as releases during these periods generate exceptionally high viewership. **Winter** also performs strongly. Conversely, the **Summer** months consistently show lower engagement for new releases. This indicates that strategic scheduling of high-impact titles during peak viewing periods, rather than just increasing the volume of releases, is essential for maximizing success.
179 | 4. **Holidays Offer Strategic Release Opportunities:** Major holidays, particularly around the New Year, can be highly effective launchpads for popular content, capitalizing on increased leisure time. However, the inherent appeal and marketing of the content remain crucial, as not all holiday releases achieve blockbuster viewership.
180 |
181 | In summary, Netflix's content strategy should continue to lean into producing engaging series, diversify its non-English language offerings (especially Korean and Spanish content), and meticulously plan its release calendar to capitalize on peak viewership seasons and specific high-impact weeks. This data-driven approach can help Netflix maintain its competitive edge and continue to grow its global subscriber base.
182 |
183 | -----
184 |
--------------------------------------------------------------------------------
/NF analysis.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 1,
6 | "id": "b8bed5e2",
7 | "metadata": {},
8 | "outputs": [
9 | {
10 | "data": {
11 | "text/html": [
12 | "
\n",
13 | "\n",
26 | "
\n",
27 | " \n",
28 | " \n",
29 | " | \n",
30 | " Title | \n",
31 | " Available Globally? | \n",
32 | " Release Date | \n",
33 | " Hours Viewed | \n",
34 | " Language Indicator | \n",
35 | " Content Type | \n",
36 | "
\n",
37 | " \n",
38 | " \n",
39 | " \n",
40 | " | 0 | \n",
41 | " The Night Agent: Season 1 | \n",
42 | " Yes | \n",
43 | " 2023-03-23 | \n",
44 | " 81,21,00,000 | \n",
45 | " English | \n",
46 | " Show | \n",
47 | "
\n",
48 | " \n",
49 | " | 1 | \n",
50 | " Ginny & Georgia: Season 2 | \n",
51 | " Yes | \n",
52 | " 2023-01-05 | \n",
53 | " 66,51,00,000 | \n",
54 | " English | \n",
55 | " Show | \n",
56 | "
\n",
57 | " \n",
58 | " | 2 | \n",
59 | " The Glory: Season 1 // 더 글로리: 시즌 1 | \n",
60 | " Yes | \n",
61 | " 2022-12-30 | \n",
62 | " 62,28,00,000 | \n",
63 | " Korean | \n",
64 | " Show | \n",
65 | "
\n",
66 | " \n",
67 | " | 3 | \n",
68 | " Wednesday: Season 1 | \n",
69 | " Yes | \n",
70 | " 2022-11-23 | \n",
71 | " 50,77,00,000 | \n",
72 | " English | \n",
73 | " Show | \n",
74 | "
\n",
75 | " \n",
76 | " | 4 | \n",
77 | " Queen Charlotte: A Bridgerton Story | \n",
78 | " Yes | \n",
79 | " 2023-05-04 | \n",
80 | " 50,30,00,000 | \n",
81 | " English | \n",
82 | " Movie | \n",
83 | "
\n",
84 | " \n",
85 | "
\n",
86 | "
"
87 | ],
88 | "text/plain": [
89 | " Title Available Globally? Release Date \\\n",
90 | "0 The Night Agent: Season 1 Yes 2023-03-23 \n",
91 | "1 Ginny & Georgia: Season 2 Yes 2023-01-05 \n",
92 | "2 The Glory: Season 1 // 더 글로리: 시즌 1 Yes 2022-12-30 \n",
93 | "3 Wednesday: Season 1 Yes 2022-11-23 \n",
94 | "4 Queen Charlotte: A Bridgerton Story Yes 2023-05-04 \n",
95 | "\n",
96 | " Hours Viewed Language Indicator Content Type \n",
97 | "0 81,21,00,000 English Show \n",
98 | "1 66,51,00,000 English Show \n",
99 | "2 62,28,00,000 Korean Show \n",
100 | "3 50,77,00,000 English Show \n",
101 | "4 50,30,00,000 English Movie "
102 | ]
103 | },
104 | "execution_count": 1,
105 | "metadata": {},
106 | "output_type": "execute_result"
107 | }
108 | ],
109 | "source": [
110 | "import pandas as pd\n",
111 | "import plotly.express as px\n",
112 | "import plotly.graph_objects as go\n",
113 | "import plotly.io as pio\n",
114 | "pio.templates.default = \"plotly_white\"\n",
115 | "\n",
116 | "netflix_data = pd.read_csv(\"netflix_content.csv\")\n",
117 | "\n",
118 | "netflix_data.head()"
119 | ]
120 | },
121 | {
122 | "cell_type": "code",
123 | "execution_count": 3,
124 | "id": "45a0e0ea",
125 | "metadata": {},
126 | "outputs": [
127 | {
128 | "data": {
129 | "text/html": [
130 | "\n",
131 | "\n",
144 | "
\n",
145 | " \n",
146 | " \n",
147 | " | \n",
148 | " Title | \n",
149 | " Hours Viewed | \n",
150 | "
\n",
151 | " \n",
152 | " \n",
153 | " \n",
154 | " | 0 | \n",
155 | " The Night Agent: Season 1 | \n",
156 | " 812100000.0 | \n",
157 | "
\n",
158 | " \n",
159 | " | 1 | \n",
160 | " Ginny & Georgia: Season 2 | \n",
161 | " 665100000.0 | \n",
162 | "
\n",
163 | " \n",
164 | " | 2 | \n",
165 | " The Glory: Season 1 // 더 글로리: 시즌 1 | \n",
166 | " 622800000.0 | \n",
167 | "
\n",
168 | " \n",
169 | " | 3 | \n",
170 | " Wednesday: Season 1 | \n",
171 | " 507700000.0 | \n",
172 | "
\n",
173 | " \n",
174 | " | 4 | \n",
175 | " Queen Charlotte: A Bridgerton Story | \n",
176 | " 503000000.0 | \n",
177 | "
\n",
178 | " \n",
179 | "
\n",
180 | "
"
181 | ],
182 | "text/plain": [
183 | " Title Hours Viewed\n",
184 | "0 The Night Agent: Season 1 812100000.0\n",
185 | "1 Ginny & Georgia: Season 2 665100000.0\n",
186 | "2 The Glory: Season 1 // 더 글로리: 시즌 1 622800000.0\n",
187 | "3 Wednesday: Season 1 507700000.0\n",
188 | "4 Queen Charlotte: A Bridgerton Story 503000000.0"
189 | ]
190 | },
191 | "execution_count": 3,
192 | "metadata": {},
193 | "output_type": "execute_result"
194 | }
195 | ],
196 | "source": [
197 | "# Cleaning and preprocessing the \"Hour viewed\" column\n",
198 | "\n",
199 | "netflix_data['Hours Viewed'] = netflix_data['Hours Viewed'].replace(',', '', regex=True).astype(float)\n",
200 | "\n",
201 | "netflix_data[['Title', 'Hours Viewed']].head()"
202 | ]
203 | },
204 | {
205 | "cell_type": "code",
206 | "execution_count": 4,
207 | "id": "f165c03b",
208 | "metadata": {},
209 | "outputs": [
210 | {
211 | "data": {
212 | "application/vnd.plotly.v1+json": {
213 | "config": {
214 | "plotlyServerURL": "https://plot.ly"
215 | },
216 | "data": [
217 | {
218 | "marker": {
219 | "color": [
220 | "skyblue",
221 | "salmon"
222 | ]
223 | },
224 | "type": "bar",
225 | "x": [
226 | "Movie",
227 | "Show"
228 | ],
229 | "y": [
230 | 50637800000,
231 | 107764100000
232 | ]
233 | }
234 | ],
235 | "layout": {
236 | "height": 500,
237 | "template": {
238 | "data": {
239 | "bar": [
240 | {
241 | "error_x": {
242 | "color": "#2a3f5f"
243 | },
244 | "error_y": {
245 | "color": "#2a3f5f"
246 | },
247 | "marker": {
248 | "line": {
249 | "color": "white",
250 | "width": 0.5
251 | },
252 | "pattern": {
253 | "fillmode": "overlay",
254 | "size": 10,
255 | "solidity": 0.2
256 | }
257 | },
258 | "type": "bar"
259 | }
260 | ],
261 | "barpolar": [
262 | {
263 | "marker": {
264 | "line": {
265 | "color": "white",
266 | "width": 0.5
267 | },
268 | "pattern": {
269 | "fillmode": "overlay",
270 | "size": 10,
271 | "solidity": 0.2
272 | }
273 | },
274 | "type": "barpolar"
275 | }
276 | ],
277 | "carpet": [
278 | {
279 | "aaxis": {
280 | "endlinecolor": "#2a3f5f",
281 | "gridcolor": "#C8D4E3",
282 | "linecolor": "#C8D4E3",
283 | "minorgridcolor": "#C8D4E3",
284 | "startlinecolor": "#2a3f5f"
285 | },
286 | "baxis": {
287 | "endlinecolor": "#2a3f5f",
288 | "gridcolor": "#C8D4E3",
289 | "linecolor": "#C8D4E3",
290 | "minorgridcolor": "#C8D4E3",
291 | "startlinecolor": "#2a3f5f"
292 | },
293 | "type": "carpet"
294 | }
295 | ],
296 | "choropleth": [
297 | {
298 | "colorbar": {
299 | "outlinewidth": 0,
300 | "ticks": ""
301 | },
302 | "type": "choropleth"
303 | }
304 | ],
305 | "contour": [
306 | {
307 | "colorbar": {
308 | "outlinewidth": 0,
309 | "ticks": ""
310 | },
311 | "colorscale": [
312 | [
313 | 0,
314 | "#0d0887"
315 | ],
316 | [
317 | 0.1111111111111111,
318 | "#46039f"
319 | ],
320 | [
321 | 0.2222222222222222,
322 | "#7201a8"
323 | ],
324 | [
325 | 0.3333333333333333,
326 | "#9c179e"
327 | ],
328 | [
329 | 0.4444444444444444,
330 | "#bd3786"
331 | ],
332 | [
333 | 0.5555555555555556,
334 | "#d8576b"
335 | ],
336 | [
337 | 0.6666666666666666,
338 | "#ed7953"
339 | ],
340 | [
341 | 0.7777777777777778,
342 | "#fb9f3a"
343 | ],
344 | [
345 | 0.8888888888888888,
346 | "#fdca26"
347 | ],
348 | [
349 | 1,
350 | "#f0f921"
351 | ]
352 | ],
353 | "type": "contour"
354 | }
355 | ],
356 | "contourcarpet": [
357 | {
358 | "colorbar": {
359 | "outlinewidth": 0,
360 | "ticks": ""
361 | },
362 | "type": "contourcarpet"
363 | }
364 | ],
365 | "heatmap": [
366 | {
367 | "colorbar": {
368 | "outlinewidth": 0,
369 | "ticks": ""
370 | },
371 | "colorscale": [
372 | [
373 | 0,
374 | "#0d0887"
375 | ],
376 | [
377 | 0.1111111111111111,
378 | "#46039f"
379 | ],
380 | [
381 | 0.2222222222222222,
382 | "#7201a8"
383 | ],
384 | [
385 | 0.3333333333333333,
386 | "#9c179e"
387 | ],
388 | [
389 | 0.4444444444444444,
390 | "#bd3786"
391 | ],
392 | [
393 | 0.5555555555555556,
394 | "#d8576b"
395 | ],
396 | [
397 | 0.6666666666666666,
398 | "#ed7953"
399 | ],
400 | [
401 | 0.7777777777777778,
402 | "#fb9f3a"
403 | ],
404 | [
405 | 0.8888888888888888,
406 | "#fdca26"
407 | ],
408 | [
409 | 1,
410 | "#f0f921"
411 | ]
412 | ],
413 | "type": "heatmap"
414 | }
415 | ],
416 | "heatmapgl": [
417 | {
418 | "colorbar": {
419 | "outlinewidth": 0,
420 | "ticks": ""
421 | },
422 | "colorscale": [
423 | [
424 | 0,
425 | "#0d0887"
426 | ],
427 | [
428 | 0.1111111111111111,
429 | "#46039f"
430 | ],
431 | [
432 | 0.2222222222222222,
433 | "#7201a8"
434 | ],
435 | [
436 | 0.3333333333333333,
437 | "#9c179e"
438 | ],
439 | [
440 | 0.4444444444444444,
441 | "#bd3786"
442 | ],
443 | [
444 | 0.5555555555555556,
445 | "#d8576b"
446 | ],
447 | [
448 | 0.6666666666666666,
449 | "#ed7953"
450 | ],
451 | [
452 | 0.7777777777777778,
453 | "#fb9f3a"
454 | ],
455 | [
456 | 0.8888888888888888,
457 | "#fdca26"
458 | ],
459 | [
460 | 1,
461 | "#f0f921"
462 | ]
463 | ],
464 | "type": "heatmapgl"
465 | }
466 | ],
467 | "histogram": [
468 | {
469 | "marker": {
470 | "pattern": {
471 | "fillmode": "overlay",
472 | "size": 10,
473 | "solidity": 0.2
474 | }
475 | },
476 | "type": "histogram"
477 | }
478 | ],
479 | "histogram2d": [
480 | {
481 | "colorbar": {
482 | "outlinewidth": 0,
483 | "ticks": ""
484 | },
485 | "colorscale": [
486 | [
487 | 0,
488 | "#0d0887"
489 | ],
490 | [
491 | 0.1111111111111111,
492 | "#46039f"
493 | ],
494 | [
495 | 0.2222222222222222,
496 | "#7201a8"
497 | ],
498 | [
499 | 0.3333333333333333,
500 | "#9c179e"
501 | ],
502 | [
503 | 0.4444444444444444,
504 | "#bd3786"
505 | ],
506 | [
507 | 0.5555555555555556,
508 | "#d8576b"
509 | ],
510 | [
511 | 0.6666666666666666,
512 | "#ed7953"
513 | ],
514 | [
515 | 0.7777777777777778,
516 | "#fb9f3a"
517 | ],
518 | [
519 | 0.8888888888888888,
520 | "#fdca26"
521 | ],
522 | [
523 | 1,
524 | "#f0f921"
525 | ]
526 | ],
527 | "type": "histogram2d"
528 | }
529 | ],
530 | "histogram2dcontour": [
531 | {
532 | "colorbar": {
533 | "outlinewidth": 0,
534 | "ticks": ""
535 | },
536 | "colorscale": [
537 | [
538 | 0,
539 | "#0d0887"
540 | ],
541 | [
542 | 0.1111111111111111,
543 | "#46039f"
544 | ],
545 | [
546 | 0.2222222222222222,
547 | "#7201a8"
548 | ],
549 | [
550 | 0.3333333333333333,
551 | "#9c179e"
552 | ],
553 | [
554 | 0.4444444444444444,
555 | "#bd3786"
556 | ],
557 | [
558 | 0.5555555555555556,
559 | "#d8576b"
560 | ],
561 | [
562 | 0.6666666666666666,
563 | "#ed7953"
564 | ],
565 | [
566 | 0.7777777777777778,
567 | "#fb9f3a"
568 | ],
569 | [
570 | 0.8888888888888888,
571 | "#fdca26"
572 | ],
573 | [
574 | 1,
575 | "#f0f921"
576 | ]
577 | ],
578 | "type": "histogram2dcontour"
579 | }
580 | ],
581 | "mesh3d": [
582 | {
583 | "colorbar": {
584 | "outlinewidth": 0,
585 | "ticks": ""
586 | },
587 | "type": "mesh3d"
588 | }
589 | ],
590 | "parcoords": [
591 | {
592 | "line": {
593 | "colorbar": {
594 | "outlinewidth": 0,
595 | "ticks": ""
596 | }
597 | },
598 | "type": "parcoords"
599 | }
600 | ],
601 | "pie": [
602 | {
603 | "automargin": true,
604 | "type": "pie"
605 | }
606 | ],
607 | "scatter": [
608 | {
609 | "fillpattern": {
610 | "fillmode": "overlay",
611 | "size": 10,
612 | "solidity": 0.2
613 | },
614 | "type": "scatter"
615 | }
616 | ],
617 | "scatter3d": [
618 | {
619 | "line": {
620 | "colorbar": {
621 | "outlinewidth": 0,
622 | "ticks": ""
623 | }
624 | },
625 | "marker": {
626 | "colorbar": {
627 | "outlinewidth": 0,
628 | "ticks": ""
629 | }
630 | },
631 | "type": "scatter3d"
632 | }
633 | ],
634 | "scattercarpet": [
635 | {
636 | "marker": {
637 | "colorbar": {
638 | "outlinewidth": 0,
639 | "ticks": ""
640 | }
641 | },
642 | "type": "scattercarpet"
643 | }
644 | ],
645 | "scattergeo": [
646 | {
647 | "marker": {
648 | "colorbar": {
649 | "outlinewidth": 0,
650 | "ticks": ""
651 | }
652 | },
653 | "type": "scattergeo"
654 | }
655 | ],
656 | "scattergl": [
657 | {
658 | "marker": {
659 | "colorbar": {
660 | "outlinewidth": 0,
661 | "ticks": ""
662 | }
663 | },
664 | "type": "scattergl"
665 | }
666 | ],
667 | "scattermapbox": [
668 | {
669 | "marker": {
670 | "colorbar": {
671 | "outlinewidth": 0,
672 | "ticks": ""
673 | }
674 | },
675 | "type": "scattermapbox"
676 | }
677 | ],
678 | "scatterpolar": [
679 | {
680 | "marker": {
681 | "colorbar": {
682 | "outlinewidth": 0,
683 | "ticks": ""
684 | }
685 | },
686 | "type": "scatterpolar"
687 | }
688 | ],
689 | "scatterpolargl": [
690 | {
691 | "marker": {
692 | "colorbar": {
693 | "outlinewidth": 0,
694 | "ticks": ""
695 | }
696 | },
697 | "type": "scatterpolargl"
698 | }
699 | ],
700 | "scatterternary": [
701 | {
702 | "marker": {
703 | "colorbar": {
704 | "outlinewidth": 0,
705 | "ticks": ""
706 | }
707 | },
708 | "type": "scatterternary"
709 | }
710 | ],
711 | "surface": [
712 | {
713 | "colorbar": {
714 | "outlinewidth": 0,
715 | "ticks": ""
716 | },
717 | "colorscale": [
718 | [
719 | 0,
720 | "#0d0887"
721 | ],
722 | [
723 | 0.1111111111111111,
724 | "#46039f"
725 | ],
726 | [
727 | 0.2222222222222222,
728 | "#7201a8"
729 | ],
730 | [
731 | 0.3333333333333333,
732 | "#9c179e"
733 | ],
734 | [
735 | 0.4444444444444444,
736 | "#bd3786"
737 | ],
738 | [
739 | 0.5555555555555556,
740 | "#d8576b"
741 | ],
742 | [
743 | 0.6666666666666666,
744 | "#ed7953"
745 | ],
746 | [
747 | 0.7777777777777778,
748 | "#fb9f3a"
749 | ],
750 | [
751 | 0.8888888888888888,
752 | "#fdca26"
753 | ],
754 | [
755 | 1,
756 | "#f0f921"
757 | ]
758 | ],
759 | "type": "surface"
760 | }
761 | ],
762 | "table": [
763 | {
764 | "cells": {
765 | "fill": {
766 | "color": "#EBF0F8"
767 | },
768 | "line": {
769 | "color": "white"
770 | }
771 | },
772 | "header": {
773 | "fill": {
774 | "color": "#C8D4E3"
775 | },
776 | "line": {
777 | "color": "white"
778 | }
779 | },
780 | "type": "table"
781 | }
782 | ]
783 | },
784 | "layout": {
785 | "annotationdefaults": {
786 | "arrowcolor": "#2a3f5f",
787 | "arrowhead": 0,
788 | "arrowwidth": 1
789 | },
790 | "autotypenumbers": "strict",
791 | "coloraxis": {
792 | "colorbar": {
793 | "outlinewidth": 0,
794 | "ticks": ""
795 | }
796 | },
797 | "colorscale": {
798 | "diverging": [
799 | [
800 | 0,
801 | "#8e0152"
802 | ],
803 | [
804 | 0.1,
805 | "#c51b7d"
806 | ],
807 | [
808 | 0.2,
809 | "#de77ae"
810 | ],
811 | [
812 | 0.3,
813 | "#f1b6da"
814 | ],
815 | [
816 | 0.4,
817 | "#fde0ef"
818 | ],
819 | [
820 | 0.5,
821 | "#f7f7f7"
822 | ],
823 | [
824 | 0.6,
825 | "#e6f5d0"
826 | ],
827 | [
828 | 0.7,
829 | "#b8e186"
830 | ],
831 | [
832 | 0.8,
833 | "#7fbc41"
834 | ],
835 | [
836 | 0.9,
837 | "#4d9221"
838 | ],
839 | [
840 | 1,
841 | "#276419"
842 | ]
843 | ],
844 | "sequential": [
845 | [
846 | 0,
847 | "#0d0887"
848 | ],
849 | [
850 | 0.1111111111111111,
851 | "#46039f"
852 | ],
853 | [
854 | 0.2222222222222222,
855 | "#7201a8"
856 | ],
857 | [
858 | 0.3333333333333333,
859 | "#9c179e"
860 | ],
861 | [
862 | 0.4444444444444444,
863 | "#bd3786"
864 | ],
865 | [
866 | 0.5555555555555556,
867 | "#d8576b"
868 | ],
869 | [
870 | 0.6666666666666666,
871 | "#ed7953"
872 | ],
873 | [
874 | 0.7777777777777778,
875 | "#fb9f3a"
876 | ],
877 | [
878 | 0.8888888888888888,
879 | "#fdca26"
880 | ],
881 | [
882 | 1,
883 | "#f0f921"
884 | ]
885 | ],
886 | "sequentialminus": [
887 | [
888 | 0,
889 | "#0d0887"
890 | ],
891 | [
892 | 0.1111111111111111,
893 | "#46039f"
894 | ],
895 | [
896 | 0.2222222222222222,
897 | "#7201a8"
898 | ],
899 | [
900 | 0.3333333333333333,
901 | "#9c179e"
902 | ],
903 | [
904 | 0.4444444444444444,
905 | "#bd3786"
906 | ],
907 | [
908 | 0.5555555555555556,
909 | "#d8576b"
910 | ],
911 | [
912 | 0.6666666666666666,
913 | "#ed7953"
914 | ],
915 | [
916 | 0.7777777777777778,
917 | "#fb9f3a"
918 | ],
919 | [
920 | 0.8888888888888888,
921 | "#fdca26"
922 | ],
923 | [
924 | 1,
925 | "#f0f921"
926 | ]
927 | ]
928 | },
929 | "colorway": [
930 | "#636efa",
931 | "#EF553B",
932 | "#00cc96",
933 | "#ab63fa",
934 | "#FFA15A",
935 | "#19d3f3",
936 | "#FF6692",
937 | "#B6E880",
938 | "#FF97FF",
939 | "#FECB52"
940 | ],
941 | "font": {
942 | "color": "#2a3f5f"
943 | },
944 | "geo": {
945 | "bgcolor": "white",
946 | "lakecolor": "white",
947 | "landcolor": "white",
948 | "showlakes": true,
949 | "showland": true,
950 | "subunitcolor": "#C8D4E3"
951 | },
952 | "hoverlabel": {
953 | "align": "left"
954 | },
955 | "hovermode": "closest",
956 | "mapbox": {
957 | "style": "light"
958 | },
959 | "paper_bgcolor": "white",
960 | "plot_bgcolor": "white",
961 | "polar": {
962 | "angularaxis": {
963 | "gridcolor": "#EBF0F8",
964 | "linecolor": "#EBF0F8",
965 | "ticks": ""
966 | },
967 | "bgcolor": "white",
968 | "radialaxis": {
969 | "gridcolor": "#EBF0F8",
970 | "linecolor": "#EBF0F8",
971 | "ticks": ""
972 | }
973 | },
974 | "scene": {
975 | "xaxis": {
976 | "backgroundcolor": "white",
977 | "gridcolor": "#DFE8F3",
978 | "gridwidth": 2,
979 | "linecolor": "#EBF0F8",
980 | "showbackground": true,
981 | "ticks": "",
982 | "zerolinecolor": "#EBF0F8"
983 | },
984 | "yaxis": {
985 | "backgroundcolor": "white",
986 | "gridcolor": "#DFE8F3",
987 | "gridwidth": 2,
988 | "linecolor": "#EBF0F8",
989 | "showbackground": true,
990 | "ticks": "",
991 | "zerolinecolor": "#EBF0F8"
992 | },
993 | "zaxis": {
994 | "backgroundcolor": "white",
995 | "gridcolor": "#DFE8F3",
996 | "gridwidth": 2,
997 | "linecolor": "#EBF0F8",
998 | "showbackground": true,
999 | "ticks": "",
1000 | "zerolinecolor": "#EBF0F8"
1001 | }
1002 | },
1003 | "shapedefaults": {
1004 | "line": {
1005 | "color": "#2a3f5f"
1006 | }
1007 | },
1008 | "ternary": {
1009 | "aaxis": {
1010 | "gridcolor": "#DFE8F3",
1011 | "linecolor": "#A2B1C6",
1012 | "ticks": ""
1013 | },
1014 | "baxis": {
1015 | "gridcolor": "#DFE8F3",
1016 | "linecolor": "#A2B1C6",
1017 | "ticks": ""
1018 | },
1019 | "bgcolor": "white",
1020 | "caxis": {
1021 | "gridcolor": "#DFE8F3",
1022 | "linecolor": "#A2B1C6",
1023 | "ticks": ""
1024 | }
1025 | },
1026 | "title": {
1027 | "x": 0.05
1028 | },
1029 | "xaxis": {
1030 | "automargin": true,
1031 | "gridcolor": "#EBF0F8",
1032 | "linecolor": "#EBF0F8",
1033 | "ticks": "",
1034 | "title": {
1035 | "standoff": 15
1036 | },
1037 | "zerolinecolor": "#EBF0F8",
1038 | "zerolinewidth": 2
1039 | },
1040 | "yaxis": {
1041 | "automargin": true,
1042 | "gridcolor": "#EBF0F8",
1043 | "linecolor": "#EBF0F8",
1044 | "ticks": "",
1045 | "title": {
1046 | "standoff": 15
1047 | },
1048 | "zerolinecolor": "#EBF0F8",
1049 | "zerolinewidth": 2
1050 | }
1051 | }
1052 | },
1053 | "title": {
1054 | "text": "Total Viewership Hours by Content Type (2023)"
1055 | },
1056 | "width": 800,
1057 | "xaxis": {
1058 | "tickangle": 0,
1059 | "title": {
1060 | "text": "Content Type"
1061 | }
1062 | },
1063 | "yaxis": {
1064 | "title": {
1065 | "text": "Total Hours Viewed (in billions)"
1066 | }
1067 | }
1068 | }
1069 | }
1070 | },
1071 | "metadata": {},
1072 | "output_type": "display_data"
1073 | }
1074 | ],
1075 | "source": [
1076 | "# aggregate viewership hours by content type\n",
1077 | "content_type_viewership = netflix_data.groupby('Content Type')['Hours Viewed'].sum()\n",
1078 | "\n",
1079 | "fig = go.Figure(data=[\n",
1080 | " go.Bar(\n",
1081 | " x=content_type_viewership.index,\n",
1082 | " y=content_type_viewership.values,\n",
1083 | " marker_color=['skyblue', 'salmon']\n",
1084 | " )\n",
1085 | "])\n",
1086 | "\n",
1087 | "fig.update_layout(\n",
1088 | " title='Total Viewership Hours by Content Type (2023)',\n",
1089 | " xaxis_title='Content Type',\n",
1090 | " yaxis_title='Total Hours Viewed (in billions)',\n",
1091 | " xaxis_tickangle=0,\n",
1092 | " height=500,\n",
1093 | " width=800\n",
1094 | ")\n",
1095 | "\n",
1096 | "fig.show()"
1097 | ]
1098 | },
1099 | {
1100 | "cell_type": "code",
1101 | "execution_count": 5,
1102 | "id": "9bce6496",
1103 | "metadata": {},
1104 | "outputs": [
1105 | {
1106 | "data": {
1107 | "application/vnd.plotly.v1+json": {
1108 | "config": {
1109 | "plotlyServerURL": "https://plot.ly"
1110 | },
1111 | "data": [
1112 | {
1113 | "marker": {
1114 | "color": "lightcoral"
1115 | },
1116 | "type": "bar",
1117 | "x": [
1118 | "English",
1119 | "Korean",
1120 | "Non-English",
1121 | "Japanese",
1122 | "Hindi",
1123 | "Russian"
1124 | ],
1125 | "y": [
1126 | 124441700000,
1127 | 15378400000,
1128 | 10439100000,
1129 | 7102000000,
1130 | 926100000,
1131 | 114600000
1132 | ]
1133 | }
1134 | ],
1135 | "layout": {
1136 | "height": 600,
1137 | "template": {
1138 | "data": {
1139 | "bar": [
1140 | {
1141 | "error_x": {
1142 | "color": "#2a3f5f"
1143 | },
1144 | "error_y": {
1145 | "color": "#2a3f5f"
1146 | },
1147 | "marker": {
1148 | "line": {
1149 | "color": "white",
1150 | "width": 0.5
1151 | },
1152 | "pattern": {
1153 | "fillmode": "overlay",
1154 | "size": 10,
1155 | "solidity": 0.2
1156 | }
1157 | },
1158 | "type": "bar"
1159 | }
1160 | ],
1161 | "barpolar": [
1162 | {
1163 | "marker": {
1164 | "line": {
1165 | "color": "white",
1166 | "width": 0.5
1167 | },
1168 | "pattern": {
1169 | "fillmode": "overlay",
1170 | "size": 10,
1171 | "solidity": 0.2
1172 | }
1173 | },
1174 | "type": "barpolar"
1175 | }
1176 | ],
1177 | "carpet": [
1178 | {
1179 | "aaxis": {
1180 | "endlinecolor": "#2a3f5f",
1181 | "gridcolor": "#C8D4E3",
1182 | "linecolor": "#C8D4E3",
1183 | "minorgridcolor": "#C8D4E3",
1184 | "startlinecolor": "#2a3f5f"
1185 | },
1186 | "baxis": {
1187 | "endlinecolor": "#2a3f5f",
1188 | "gridcolor": "#C8D4E3",
1189 | "linecolor": "#C8D4E3",
1190 | "minorgridcolor": "#C8D4E3",
1191 | "startlinecolor": "#2a3f5f"
1192 | },
1193 | "type": "carpet"
1194 | }
1195 | ],
1196 | "choropleth": [
1197 | {
1198 | "colorbar": {
1199 | "outlinewidth": 0,
1200 | "ticks": ""
1201 | },
1202 | "type": "choropleth"
1203 | }
1204 | ],
1205 | "contour": [
1206 | {
1207 | "colorbar": {
1208 | "outlinewidth": 0,
1209 | "ticks": ""
1210 | },
1211 | "colorscale": [
1212 | [
1213 | 0,
1214 | "#0d0887"
1215 | ],
1216 | [
1217 | 0.1111111111111111,
1218 | "#46039f"
1219 | ],
1220 | [
1221 | 0.2222222222222222,
1222 | "#7201a8"
1223 | ],
1224 | [
1225 | 0.3333333333333333,
1226 | "#9c179e"
1227 | ],
1228 | [
1229 | 0.4444444444444444,
1230 | "#bd3786"
1231 | ],
1232 | [
1233 | 0.5555555555555556,
1234 | "#d8576b"
1235 | ],
1236 | [
1237 | 0.6666666666666666,
1238 | "#ed7953"
1239 | ],
1240 | [
1241 | 0.7777777777777778,
1242 | "#fb9f3a"
1243 | ],
1244 | [
1245 | 0.8888888888888888,
1246 | "#fdca26"
1247 | ],
1248 | [
1249 | 1,
1250 | "#f0f921"
1251 | ]
1252 | ],
1253 | "type": "contour"
1254 | }
1255 | ],
1256 | "contourcarpet": [
1257 | {
1258 | "colorbar": {
1259 | "outlinewidth": 0,
1260 | "ticks": ""
1261 | },
1262 | "type": "contourcarpet"
1263 | }
1264 | ],
1265 | "heatmap": [
1266 | {
1267 | "colorbar": {
1268 | "outlinewidth": 0,
1269 | "ticks": ""
1270 | },
1271 | "colorscale": [
1272 | [
1273 | 0,
1274 | "#0d0887"
1275 | ],
1276 | [
1277 | 0.1111111111111111,
1278 | "#46039f"
1279 | ],
1280 | [
1281 | 0.2222222222222222,
1282 | "#7201a8"
1283 | ],
1284 | [
1285 | 0.3333333333333333,
1286 | "#9c179e"
1287 | ],
1288 | [
1289 | 0.4444444444444444,
1290 | "#bd3786"
1291 | ],
1292 | [
1293 | 0.5555555555555556,
1294 | "#d8576b"
1295 | ],
1296 | [
1297 | 0.6666666666666666,
1298 | "#ed7953"
1299 | ],
1300 | [
1301 | 0.7777777777777778,
1302 | "#fb9f3a"
1303 | ],
1304 | [
1305 | 0.8888888888888888,
1306 | "#fdca26"
1307 | ],
1308 | [
1309 | 1,
1310 | "#f0f921"
1311 | ]
1312 | ],
1313 | "type": "heatmap"
1314 | }
1315 | ],
1316 | "heatmapgl": [
1317 | {
1318 | "colorbar": {
1319 | "outlinewidth": 0,
1320 | "ticks": ""
1321 | },
1322 | "colorscale": [
1323 | [
1324 | 0,
1325 | "#0d0887"
1326 | ],
1327 | [
1328 | 0.1111111111111111,
1329 | "#46039f"
1330 | ],
1331 | [
1332 | 0.2222222222222222,
1333 | "#7201a8"
1334 | ],
1335 | [
1336 | 0.3333333333333333,
1337 | "#9c179e"
1338 | ],
1339 | [
1340 | 0.4444444444444444,
1341 | "#bd3786"
1342 | ],
1343 | [
1344 | 0.5555555555555556,
1345 | "#d8576b"
1346 | ],
1347 | [
1348 | 0.6666666666666666,
1349 | "#ed7953"
1350 | ],
1351 | [
1352 | 0.7777777777777778,
1353 | "#fb9f3a"
1354 | ],
1355 | [
1356 | 0.8888888888888888,
1357 | "#fdca26"
1358 | ],
1359 | [
1360 | 1,
1361 | "#f0f921"
1362 | ]
1363 | ],
1364 | "type": "heatmapgl"
1365 | }
1366 | ],
1367 | "histogram": [
1368 | {
1369 | "marker": {
1370 | "pattern": {
1371 | "fillmode": "overlay",
1372 | "size": 10,
1373 | "solidity": 0.2
1374 | }
1375 | },
1376 | "type": "histogram"
1377 | }
1378 | ],
1379 | "histogram2d": [
1380 | {
1381 | "colorbar": {
1382 | "outlinewidth": 0,
1383 | "ticks": ""
1384 | },
1385 | "colorscale": [
1386 | [
1387 | 0,
1388 | "#0d0887"
1389 | ],
1390 | [
1391 | 0.1111111111111111,
1392 | "#46039f"
1393 | ],
1394 | [
1395 | 0.2222222222222222,
1396 | "#7201a8"
1397 | ],
1398 | [
1399 | 0.3333333333333333,
1400 | "#9c179e"
1401 | ],
1402 | [
1403 | 0.4444444444444444,
1404 | "#bd3786"
1405 | ],
1406 | [
1407 | 0.5555555555555556,
1408 | "#d8576b"
1409 | ],
1410 | [
1411 | 0.6666666666666666,
1412 | "#ed7953"
1413 | ],
1414 | [
1415 | 0.7777777777777778,
1416 | "#fb9f3a"
1417 | ],
1418 | [
1419 | 0.8888888888888888,
1420 | "#fdca26"
1421 | ],
1422 | [
1423 | 1,
1424 | "#f0f921"
1425 | ]
1426 | ],
1427 | "type": "histogram2d"
1428 | }
1429 | ],
1430 | "histogram2dcontour": [
1431 | {
1432 | "colorbar": {
1433 | "outlinewidth": 0,
1434 | "ticks": ""
1435 | },
1436 | "colorscale": [
1437 | [
1438 | 0,
1439 | "#0d0887"
1440 | ],
1441 | [
1442 | 0.1111111111111111,
1443 | "#46039f"
1444 | ],
1445 | [
1446 | 0.2222222222222222,
1447 | "#7201a8"
1448 | ],
1449 | [
1450 | 0.3333333333333333,
1451 | "#9c179e"
1452 | ],
1453 | [
1454 | 0.4444444444444444,
1455 | "#bd3786"
1456 | ],
1457 | [
1458 | 0.5555555555555556,
1459 | "#d8576b"
1460 | ],
1461 | [
1462 | 0.6666666666666666,
1463 | "#ed7953"
1464 | ],
1465 | [
1466 | 0.7777777777777778,
1467 | "#fb9f3a"
1468 | ],
1469 | [
1470 | 0.8888888888888888,
1471 | "#fdca26"
1472 | ],
1473 | [
1474 | 1,
1475 | "#f0f921"
1476 | ]
1477 | ],
1478 | "type": "histogram2dcontour"
1479 | }
1480 | ],
1481 | "mesh3d": [
1482 | {
1483 | "colorbar": {
1484 | "outlinewidth": 0,
1485 | "ticks": ""
1486 | },
1487 | "type": "mesh3d"
1488 | }
1489 | ],
1490 | "parcoords": [
1491 | {
1492 | "line": {
1493 | "colorbar": {
1494 | "outlinewidth": 0,
1495 | "ticks": ""
1496 | }
1497 | },
1498 | "type": "parcoords"
1499 | }
1500 | ],
1501 | "pie": [
1502 | {
1503 | "automargin": true,
1504 | "type": "pie"
1505 | }
1506 | ],
1507 | "scatter": [
1508 | {
1509 | "fillpattern": {
1510 | "fillmode": "overlay",
1511 | "size": 10,
1512 | "solidity": 0.2
1513 | },
1514 | "type": "scatter"
1515 | }
1516 | ],
1517 | "scatter3d": [
1518 | {
1519 | "line": {
1520 | "colorbar": {
1521 | "outlinewidth": 0,
1522 | "ticks": ""
1523 | }
1524 | },
1525 | "marker": {
1526 | "colorbar": {
1527 | "outlinewidth": 0,
1528 | "ticks": ""
1529 | }
1530 | },
1531 | "type": "scatter3d"
1532 | }
1533 | ],
1534 | "scattercarpet": [
1535 | {
1536 | "marker": {
1537 | "colorbar": {
1538 | "outlinewidth": 0,
1539 | "ticks": ""
1540 | }
1541 | },
1542 | "type": "scattercarpet"
1543 | }
1544 | ],
1545 | "scattergeo": [
1546 | {
1547 | "marker": {
1548 | "colorbar": {
1549 | "outlinewidth": 0,
1550 | "ticks": ""
1551 | }
1552 | },
1553 | "type": "scattergeo"
1554 | }
1555 | ],
1556 | "scattergl": [
1557 | {
1558 | "marker": {
1559 | "colorbar": {
1560 | "outlinewidth": 0,
1561 | "ticks": ""
1562 | }
1563 | },
1564 | "type": "scattergl"
1565 | }
1566 | ],
1567 | "scattermapbox": [
1568 | {
1569 | "marker": {
1570 | "colorbar": {
1571 | "outlinewidth": 0,
1572 | "ticks": ""
1573 | }
1574 | },
1575 | "type": "scattermapbox"
1576 | }
1577 | ],
1578 | "scatterpolar": [
1579 | {
1580 | "marker": {
1581 | "colorbar": {
1582 | "outlinewidth": 0,
1583 | "ticks": ""
1584 | }
1585 | },
1586 | "type": "scatterpolar"
1587 | }
1588 | ],
1589 | "scatterpolargl": [
1590 | {
1591 | "marker": {
1592 | "colorbar": {
1593 | "outlinewidth": 0,
1594 | "ticks": ""
1595 | }
1596 | },
1597 | "type": "scatterpolargl"
1598 | }
1599 | ],
1600 | "scatterternary": [
1601 | {
1602 | "marker": {
1603 | "colorbar": {
1604 | "outlinewidth": 0,
1605 | "ticks": ""
1606 | }
1607 | },
1608 | "type": "scatterternary"
1609 | }
1610 | ],
1611 | "surface": [
1612 | {
1613 | "colorbar": {
1614 | "outlinewidth": 0,
1615 | "ticks": ""
1616 | },
1617 | "colorscale": [
1618 | [
1619 | 0,
1620 | "#0d0887"
1621 | ],
1622 | [
1623 | 0.1111111111111111,
1624 | "#46039f"
1625 | ],
1626 | [
1627 | 0.2222222222222222,
1628 | "#7201a8"
1629 | ],
1630 | [
1631 | 0.3333333333333333,
1632 | "#9c179e"
1633 | ],
1634 | [
1635 | 0.4444444444444444,
1636 | "#bd3786"
1637 | ],
1638 | [
1639 | 0.5555555555555556,
1640 | "#d8576b"
1641 | ],
1642 | [
1643 | 0.6666666666666666,
1644 | "#ed7953"
1645 | ],
1646 | [
1647 | 0.7777777777777778,
1648 | "#fb9f3a"
1649 | ],
1650 | [
1651 | 0.8888888888888888,
1652 | "#fdca26"
1653 | ],
1654 | [
1655 | 1,
1656 | "#f0f921"
1657 | ]
1658 | ],
1659 | "type": "surface"
1660 | }
1661 | ],
1662 | "table": [
1663 | {
1664 | "cells": {
1665 | "fill": {
1666 | "color": "#EBF0F8"
1667 | },
1668 | "line": {
1669 | "color": "white"
1670 | }
1671 | },
1672 | "header": {
1673 | "fill": {
1674 | "color": "#C8D4E3"
1675 | },
1676 | "line": {
1677 | "color": "white"
1678 | }
1679 | },
1680 | "type": "table"
1681 | }
1682 | ]
1683 | },
1684 | "layout": {
1685 | "annotationdefaults": {
1686 | "arrowcolor": "#2a3f5f",
1687 | "arrowhead": 0,
1688 | "arrowwidth": 1
1689 | },
1690 | "autotypenumbers": "strict",
1691 | "coloraxis": {
1692 | "colorbar": {
1693 | "outlinewidth": 0,
1694 | "ticks": ""
1695 | }
1696 | },
1697 | "colorscale": {
1698 | "diverging": [
1699 | [
1700 | 0,
1701 | "#8e0152"
1702 | ],
1703 | [
1704 | 0.1,
1705 | "#c51b7d"
1706 | ],
1707 | [
1708 | 0.2,
1709 | "#de77ae"
1710 | ],
1711 | [
1712 | 0.3,
1713 | "#f1b6da"
1714 | ],
1715 | [
1716 | 0.4,
1717 | "#fde0ef"
1718 | ],
1719 | [
1720 | 0.5,
1721 | "#f7f7f7"
1722 | ],
1723 | [
1724 | 0.6,
1725 | "#e6f5d0"
1726 | ],
1727 | [
1728 | 0.7,
1729 | "#b8e186"
1730 | ],
1731 | [
1732 | 0.8,
1733 | "#7fbc41"
1734 | ],
1735 | [
1736 | 0.9,
1737 | "#4d9221"
1738 | ],
1739 | [
1740 | 1,
1741 | "#276419"
1742 | ]
1743 | ],
1744 | "sequential": [
1745 | [
1746 | 0,
1747 | "#0d0887"
1748 | ],
1749 | [
1750 | 0.1111111111111111,
1751 | "#46039f"
1752 | ],
1753 | [
1754 | 0.2222222222222222,
1755 | "#7201a8"
1756 | ],
1757 | [
1758 | 0.3333333333333333,
1759 | "#9c179e"
1760 | ],
1761 | [
1762 | 0.4444444444444444,
1763 | "#bd3786"
1764 | ],
1765 | [
1766 | 0.5555555555555556,
1767 | "#d8576b"
1768 | ],
1769 | [
1770 | 0.6666666666666666,
1771 | "#ed7953"
1772 | ],
1773 | [
1774 | 0.7777777777777778,
1775 | "#fb9f3a"
1776 | ],
1777 | [
1778 | 0.8888888888888888,
1779 | "#fdca26"
1780 | ],
1781 | [
1782 | 1,
1783 | "#f0f921"
1784 | ]
1785 | ],
1786 | "sequentialminus": [
1787 | [
1788 | 0,
1789 | "#0d0887"
1790 | ],
1791 | [
1792 | 0.1111111111111111,
1793 | "#46039f"
1794 | ],
1795 | [
1796 | 0.2222222222222222,
1797 | "#7201a8"
1798 | ],
1799 | [
1800 | 0.3333333333333333,
1801 | "#9c179e"
1802 | ],
1803 | [
1804 | 0.4444444444444444,
1805 | "#bd3786"
1806 | ],
1807 | [
1808 | 0.5555555555555556,
1809 | "#d8576b"
1810 | ],
1811 | [
1812 | 0.6666666666666666,
1813 | "#ed7953"
1814 | ],
1815 | [
1816 | 0.7777777777777778,
1817 | "#fb9f3a"
1818 | ],
1819 | [
1820 | 0.8888888888888888,
1821 | "#fdca26"
1822 | ],
1823 | [
1824 | 1,
1825 | "#f0f921"
1826 | ]
1827 | ]
1828 | },
1829 | "colorway": [
1830 | "#636efa",
1831 | "#EF553B",
1832 | "#00cc96",
1833 | "#ab63fa",
1834 | "#FFA15A",
1835 | "#19d3f3",
1836 | "#FF6692",
1837 | "#B6E880",
1838 | "#FF97FF",
1839 | "#FECB52"
1840 | ],
1841 | "font": {
1842 | "color": "#2a3f5f"
1843 | },
1844 | "geo": {
1845 | "bgcolor": "white",
1846 | "lakecolor": "white",
1847 | "landcolor": "white",
1848 | "showlakes": true,
1849 | "showland": true,
1850 | "subunitcolor": "#C8D4E3"
1851 | },
1852 | "hoverlabel": {
1853 | "align": "left"
1854 | },
1855 | "hovermode": "closest",
1856 | "mapbox": {
1857 | "style": "light"
1858 | },
1859 | "paper_bgcolor": "white",
1860 | "plot_bgcolor": "white",
1861 | "polar": {
1862 | "angularaxis": {
1863 | "gridcolor": "#EBF0F8",
1864 | "linecolor": "#EBF0F8",
1865 | "ticks": ""
1866 | },
1867 | "bgcolor": "white",
1868 | "radialaxis": {
1869 | "gridcolor": "#EBF0F8",
1870 | "linecolor": "#EBF0F8",
1871 | "ticks": ""
1872 | }
1873 | },
1874 | "scene": {
1875 | "xaxis": {
1876 | "backgroundcolor": "white",
1877 | "gridcolor": "#DFE8F3",
1878 | "gridwidth": 2,
1879 | "linecolor": "#EBF0F8",
1880 | "showbackground": true,
1881 | "ticks": "",
1882 | "zerolinecolor": "#EBF0F8"
1883 | },
1884 | "yaxis": {
1885 | "backgroundcolor": "white",
1886 | "gridcolor": "#DFE8F3",
1887 | "gridwidth": 2,
1888 | "linecolor": "#EBF0F8",
1889 | "showbackground": true,
1890 | "ticks": "",
1891 | "zerolinecolor": "#EBF0F8"
1892 | },
1893 | "zaxis": {
1894 | "backgroundcolor": "white",
1895 | "gridcolor": "#DFE8F3",
1896 | "gridwidth": 2,
1897 | "linecolor": "#EBF0F8",
1898 | "showbackground": true,
1899 | "ticks": "",
1900 | "zerolinecolor": "#EBF0F8"
1901 | }
1902 | },
1903 | "shapedefaults": {
1904 | "line": {
1905 | "color": "#2a3f5f"
1906 | }
1907 | },
1908 | "ternary": {
1909 | "aaxis": {
1910 | "gridcolor": "#DFE8F3",
1911 | "linecolor": "#A2B1C6",
1912 | "ticks": ""
1913 | },
1914 | "baxis": {
1915 | "gridcolor": "#DFE8F3",
1916 | "linecolor": "#A2B1C6",
1917 | "ticks": ""
1918 | },
1919 | "bgcolor": "white",
1920 | "caxis": {
1921 | "gridcolor": "#DFE8F3",
1922 | "linecolor": "#A2B1C6",
1923 | "ticks": ""
1924 | }
1925 | },
1926 | "title": {
1927 | "x": 0.05
1928 | },
1929 | "xaxis": {
1930 | "automargin": true,
1931 | "gridcolor": "#EBF0F8",
1932 | "linecolor": "#EBF0F8",
1933 | "ticks": "",
1934 | "title": {
1935 | "standoff": 15
1936 | },
1937 | "zerolinecolor": "#EBF0F8",
1938 | "zerolinewidth": 2
1939 | },
1940 | "yaxis": {
1941 | "automargin": true,
1942 | "gridcolor": "#EBF0F8",
1943 | "linecolor": "#EBF0F8",
1944 | "ticks": "",
1945 | "title": {
1946 | "standoff": 15
1947 | },
1948 | "zerolinecolor": "#EBF0F8",
1949 | "zerolinewidth": 2
1950 | }
1951 | }
1952 | },
1953 | "title": {
1954 | "text": "Total Viewership Hours by Language (2023)"
1955 | },
1956 | "width": 1000,
1957 | "xaxis": {
1958 | "tickangle": 45,
1959 | "title": {
1960 | "text": "Language"
1961 | }
1962 | },
1963 | "yaxis": {
1964 | "title": {
1965 | "text": "Total Hours Viewed (in billions)"
1966 | }
1967 | }
1968 | }
1969 | }
1970 | },
1971 | "metadata": {},
1972 | "output_type": "display_data"
1973 | }
1974 | ],
1975 | "source": [
1976 | "# aggregate viewership hours by language\n",
1977 | "language_viewership = netflix_data.groupby('Language Indicator')['Hours Viewed'].sum().sort_values(ascending=False)\n",
1978 | "\n",
1979 | "fig = go.Figure(data=[\n",
1980 | " go.Bar(\n",
1981 | " x=language_viewership.index,\n",
1982 | " y=language_viewership.values,\n",
1983 | " marker_color='lightcoral'\n",
1984 | " )\n",
1985 | "])\n",
1986 | "\n",
1987 | "fig.update_layout(\n",
1988 | " title='Total Viewership Hours by Language (2023)',\n",
1989 | " xaxis_title='Language',\n",
1990 | " yaxis_title='Total Hours Viewed (in billions)',\n",
1991 | " xaxis_tickangle=45,\n",
1992 | " height=600,\n",
1993 | " width=1000\n",
1994 | ")\n",
1995 | "\n",
1996 | "fig.show()"
1997 | ]
1998 | },
1999 | {
2000 | "cell_type": "code",
2001 | "execution_count": 6,
2002 | "id": "3abc8f64",
2003 | "metadata": {},
2004 | "outputs": [
2005 | {
2006 | "data": {
2007 | "application/vnd.plotly.v1+json": {
2008 | "config": {
2009 | "plotlyServerURL": "https://plot.ly"
2010 | },
2011 | "data": [
2012 | {
2013 | "line": {
2014 | "color": "blue"
2015 | },
2016 | "marker": {
2017 | "color": "blue"
2018 | },
2019 | "mode": "lines+markers",
2020 | "type": "scatter",
2021 | "x": [
2022 | 1,
2023 | 2,
2024 | 3,
2025 | 4,
2026 | 5,
2027 | 6,
2028 | 7,
2029 | 8,
2030 | 9,
2031 | 10,
2032 | 11,
2033 | 12
2034 | ],
2035 | "y": [
2036 | 7271600000,
2037 | 7103700000,
2038 | 7437100000,
2039 | 6865700000,
2040 | 7094600000,
2041 | 8522000000,
2042 | 6524800000,
2043 | 6817800000,
2044 | 7262200000,
2045 | 8123200000,
2046 | 7749500000,
2047 | 10055800000
2048 | ]
2049 | }
2050 | ],
2051 | "layout": {
2052 | "height": 600,
2053 | "template": {
2054 | "data": {
2055 | "bar": [
2056 | {
2057 | "error_x": {
2058 | "color": "#2a3f5f"
2059 | },
2060 | "error_y": {
2061 | "color": "#2a3f5f"
2062 | },
2063 | "marker": {
2064 | "line": {
2065 | "color": "white",
2066 | "width": 0.5
2067 | },
2068 | "pattern": {
2069 | "fillmode": "overlay",
2070 | "size": 10,
2071 | "solidity": 0.2
2072 | }
2073 | },
2074 | "type": "bar"
2075 | }
2076 | ],
2077 | "barpolar": [
2078 | {
2079 | "marker": {
2080 | "line": {
2081 | "color": "white",
2082 | "width": 0.5
2083 | },
2084 | "pattern": {
2085 | "fillmode": "overlay",
2086 | "size": 10,
2087 | "solidity": 0.2
2088 | }
2089 | },
2090 | "type": "barpolar"
2091 | }
2092 | ],
2093 | "carpet": [
2094 | {
2095 | "aaxis": {
2096 | "endlinecolor": "#2a3f5f",
2097 | "gridcolor": "#C8D4E3",
2098 | "linecolor": "#C8D4E3",
2099 | "minorgridcolor": "#C8D4E3",
2100 | "startlinecolor": "#2a3f5f"
2101 | },
2102 | "baxis": {
2103 | "endlinecolor": "#2a3f5f",
2104 | "gridcolor": "#C8D4E3",
2105 | "linecolor": "#C8D4E3",
2106 | "minorgridcolor": "#C8D4E3",
2107 | "startlinecolor": "#2a3f5f"
2108 | },
2109 | "type": "carpet"
2110 | }
2111 | ],
2112 | "choropleth": [
2113 | {
2114 | "colorbar": {
2115 | "outlinewidth": 0,
2116 | "ticks": ""
2117 | },
2118 | "type": "choropleth"
2119 | }
2120 | ],
2121 | "contour": [
2122 | {
2123 | "colorbar": {
2124 | "outlinewidth": 0,
2125 | "ticks": ""
2126 | },
2127 | "colorscale": [
2128 | [
2129 | 0,
2130 | "#0d0887"
2131 | ],
2132 | [
2133 | 0.1111111111111111,
2134 | "#46039f"
2135 | ],
2136 | [
2137 | 0.2222222222222222,
2138 | "#7201a8"
2139 | ],
2140 | [
2141 | 0.3333333333333333,
2142 | "#9c179e"
2143 | ],
2144 | [
2145 | 0.4444444444444444,
2146 | "#bd3786"
2147 | ],
2148 | [
2149 | 0.5555555555555556,
2150 | "#d8576b"
2151 | ],
2152 | [
2153 | 0.6666666666666666,
2154 | "#ed7953"
2155 | ],
2156 | [
2157 | 0.7777777777777778,
2158 | "#fb9f3a"
2159 | ],
2160 | [
2161 | 0.8888888888888888,
2162 | "#fdca26"
2163 | ],
2164 | [
2165 | 1,
2166 | "#f0f921"
2167 | ]
2168 | ],
2169 | "type": "contour"
2170 | }
2171 | ],
2172 | "contourcarpet": [
2173 | {
2174 | "colorbar": {
2175 | "outlinewidth": 0,
2176 | "ticks": ""
2177 | },
2178 | "type": "contourcarpet"
2179 | }
2180 | ],
2181 | "heatmap": [
2182 | {
2183 | "colorbar": {
2184 | "outlinewidth": 0,
2185 | "ticks": ""
2186 | },
2187 | "colorscale": [
2188 | [
2189 | 0,
2190 | "#0d0887"
2191 | ],
2192 | [
2193 | 0.1111111111111111,
2194 | "#46039f"
2195 | ],
2196 | [
2197 | 0.2222222222222222,
2198 | "#7201a8"
2199 | ],
2200 | [
2201 | 0.3333333333333333,
2202 | "#9c179e"
2203 | ],
2204 | [
2205 | 0.4444444444444444,
2206 | "#bd3786"
2207 | ],
2208 | [
2209 | 0.5555555555555556,
2210 | "#d8576b"
2211 | ],
2212 | [
2213 | 0.6666666666666666,
2214 | "#ed7953"
2215 | ],
2216 | [
2217 | 0.7777777777777778,
2218 | "#fb9f3a"
2219 | ],
2220 | [
2221 | 0.8888888888888888,
2222 | "#fdca26"
2223 | ],
2224 | [
2225 | 1,
2226 | "#f0f921"
2227 | ]
2228 | ],
2229 | "type": "heatmap"
2230 | }
2231 | ],
2232 | "heatmapgl": [
2233 | {
2234 | "colorbar": {
2235 | "outlinewidth": 0,
2236 | "ticks": ""
2237 | },
2238 | "colorscale": [
2239 | [
2240 | 0,
2241 | "#0d0887"
2242 | ],
2243 | [
2244 | 0.1111111111111111,
2245 | "#46039f"
2246 | ],
2247 | [
2248 | 0.2222222222222222,
2249 | "#7201a8"
2250 | ],
2251 | [
2252 | 0.3333333333333333,
2253 | "#9c179e"
2254 | ],
2255 | [
2256 | 0.4444444444444444,
2257 | "#bd3786"
2258 | ],
2259 | [
2260 | 0.5555555555555556,
2261 | "#d8576b"
2262 | ],
2263 | [
2264 | 0.6666666666666666,
2265 | "#ed7953"
2266 | ],
2267 | [
2268 | 0.7777777777777778,
2269 | "#fb9f3a"
2270 | ],
2271 | [
2272 | 0.8888888888888888,
2273 | "#fdca26"
2274 | ],
2275 | [
2276 | 1,
2277 | "#f0f921"
2278 | ]
2279 | ],
2280 | "type": "heatmapgl"
2281 | }
2282 | ],
2283 | "histogram": [
2284 | {
2285 | "marker": {
2286 | "pattern": {
2287 | "fillmode": "overlay",
2288 | "size": 10,
2289 | "solidity": 0.2
2290 | }
2291 | },
2292 | "type": "histogram"
2293 | }
2294 | ],
2295 | "histogram2d": [
2296 | {
2297 | "colorbar": {
2298 | "outlinewidth": 0,
2299 | "ticks": ""
2300 | },
2301 | "colorscale": [
2302 | [
2303 | 0,
2304 | "#0d0887"
2305 | ],
2306 | [
2307 | 0.1111111111111111,
2308 | "#46039f"
2309 | ],
2310 | [
2311 | 0.2222222222222222,
2312 | "#7201a8"
2313 | ],
2314 | [
2315 | 0.3333333333333333,
2316 | "#9c179e"
2317 | ],
2318 | [
2319 | 0.4444444444444444,
2320 | "#bd3786"
2321 | ],
2322 | [
2323 | 0.5555555555555556,
2324 | "#d8576b"
2325 | ],
2326 | [
2327 | 0.6666666666666666,
2328 | "#ed7953"
2329 | ],
2330 | [
2331 | 0.7777777777777778,
2332 | "#fb9f3a"
2333 | ],
2334 | [
2335 | 0.8888888888888888,
2336 | "#fdca26"
2337 | ],
2338 | [
2339 | 1,
2340 | "#f0f921"
2341 | ]
2342 | ],
2343 | "type": "histogram2d"
2344 | }
2345 | ],
2346 | "histogram2dcontour": [
2347 | {
2348 | "colorbar": {
2349 | "outlinewidth": 0,
2350 | "ticks": ""
2351 | },
2352 | "colorscale": [
2353 | [
2354 | 0,
2355 | "#0d0887"
2356 | ],
2357 | [
2358 | 0.1111111111111111,
2359 | "#46039f"
2360 | ],
2361 | [
2362 | 0.2222222222222222,
2363 | "#7201a8"
2364 | ],
2365 | [
2366 | 0.3333333333333333,
2367 | "#9c179e"
2368 | ],
2369 | [
2370 | 0.4444444444444444,
2371 | "#bd3786"
2372 | ],
2373 | [
2374 | 0.5555555555555556,
2375 | "#d8576b"
2376 | ],
2377 | [
2378 | 0.6666666666666666,
2379 | "#ed7953"
2380 | ],
2381 | [
2382 | 0.7777777777777778,
2383 | "#fb9f3a"
2384 | ],
2385 | [
2386 | 0.8888888888888888,
2387 | "#fdca26"
2388 | ],
2389 | [
2390 | 1,
2391 | "#f0f921"
2392 | ]
2393 | ],
2394 | "type": "histogram2dcontour"
2395 | }
2396 | ],
2397 | "mesh3d": [
2398 | {
2399 | "colorbar": {
2400 | "outlinewidth": 0,
2401 | "ticks": ""
2402 | },
2403 | "type": "mesh3d"
2404 | }
2405 | ],
2406 | "parcoords": [
2407 | {
2408 | "line": {
2409 | "colorbar": {
2410 | "outlinewidth": 0,
2411 | "ticks": ""
2412 | }
2413 | },
2414 | "type": "parcoords"
2415 | }
2416 | ],
2417 | "pie": [
2418 | {
2419 | "automargin": true,
2420 | "type": "pie"
2421 | }
2422 | ],
2423 | "scatter": [
2424 | {
2425 | "fillpattern": {
2426 | "fillmode": "overlay",
2427 | "size": 10,
2428 | "solidity": 0.2
2429 | },
2430 | "type": "scatter"
2431 | }
2432 | ],
2433 | "scatter3d": [
2434 | {
2435 | "line": {
2436 | "colorbar": {
2437 | "outlinewidth": 0,
2438 | "ticks": ""
2439 | }
2440 | },
2441 | "marker": {
2442 | "colorbar": {
2443 | "outlinewidth": 0,
2444 | "ticks": ""
2445 | }
2446 | },
2447 | "type": "scatter3d"
2448 | }
2449 | ],
2450 | "scattercarpet": [
2451 | {
2452 | "marker": {
2453 | "colorbar": {
2454 | "outlinewidth": 0,
2455 | "ticks": ""
2456 | }
2457 | },
2458 | "type": "scattercarpet"
2459 | }
2460 | ],
2461 | "scattergeo": [
2462 | {
2463 | "marker": {
2464 | "colorbar": {
2465 | "outlinewidth": 0,
2466 | "ticks": ""
2467 | }
2468 | },
2469 | "type": "scattergeo"
2470 | }
2471 | ],
2472 | "scattergl": [
2473 | {
2474 | "marker": {
2475 | "colorbar": {
2476 | "outlinewidth": 0,
2477 | "ticks": ""
2478 | }
2479 | },
2480 | "type": "scattergl"
2481 | }
2482 | ],
2483 | "scattermapbox": [
2484 | {
2485 | "marker": {
2486 | "colorbar": {
2487 | "outlinewidth": 0,
2488 | "ticks": ""
2489 | }
2490 | },
2491 | "type": "scattermapbox"
2492 | }
2493 | ],
2494 | "scatterpolar": [
2495 | {
2496 | "marker": {
2497 | "colorbar": {
2498 | "outlinewidth": 0,
2499 | "ticks": ""
2500 | }
2501 | },
2502 | "type": "scatterpolar"
2503 | }
2504 | ],
2505 | "scatterpolargl": [
2506 | {
2507 | "marker": {
2508 | "colorbar": {
2509 | "outlinewidth": 0,
2510 | "ticks": ""
2511 | }
2512 | },
2513 | "type": "scatterpolargl"
2514 | }
2515 | ],
2516 | "scatterternary": [
2517 | {
2518 | "marker": {
2519 | "colorbar": {
2520 | "outlinewidth": 0,
2521 | "ticks": ""
2522 | }
2523 | },
2524 | "type": "scatterternary"
2525 | }
2526 | ],
2527 | "surface": [
2528 | {
2529 | "colorbar": {
2530 | "outlinewidth": 0,
2531 | "ticks": ""
2532 | },
2533 | "colorscale": [
2534 | [
2535 | 0,
2536 | "#0d0887"
2537 | ],
2538 | [
2539 | 0.1111111111111111,
2540 | "#46039f"
2541 | ],
2542 | [
2543 | 0.2222222222222222,
2544 | "#7201a8"
2545 | ],
2546 | [
2547 | 0.3333333333333333,
2548 | "#9c179e"
2549 | ],
2550 | [
2551 | 0.4444444444444444,
2552 | "#bd3786"
2553 | ],
2554 | [
2555 | 0.5555555555555556,
2556 | "#d8576b"
2557 | ],
2558 | [
2559 | 0.6666666666666666,
2560 | "#ed7953"
2561 | ],
2562 | [
2563 | 0.7777777777777778,
2564 | "#fb9f3a"
2565 | ],
2566 | [
2567 | 0.8888888888888888,
2568 | "#fdca26"
2569 | ],
2570 | [
2571 | 1,
2572 | "#f0f921"
2573 | ]
2574 | ],
2575 | "type": "surface"
2576 | }
2577 | ],
2578 | "table": [
2579 | {
2580 | "cells": {
2581 | "fill": {
2582 | "color": "#EBF0F8"
2583 | },
2584 | "line": {
2585 | "color": "white"
2586 | }
2587 | },
2588 | "header": {
2589 | "fill": {
2590 | "color": "#C8D4E3"
2591 | },
2592 | "line": {
2593 | "color": "white"
2594 | }
2595 | },
2596 | "type": "table"
2597 | }
2598 | ]
2599 | },
2600 | "layout": {
2601 | "annotationdefaults": {
2602 | "arrowcolor": "#2a3f5f",
2603 | "arrowhead": 0,
2604 | "arrowwidth": 1
2605 | },
2606 | "autotypenumbers": "strict",
2607 | "coloraxis": {
2608 | "colorbar": {
2609 | "outlinewidth": 0,
2610 | "ticks": ""
2611 | }
2612 | },
2613 | "colorscale": {
2614 | "diverging": [
2615 | [
2616 | 0,
2617 | "#8e0152"
2618 | ],
2619 | [
2620 | 0.1,
2621 | "#c51b7d"
2622 | ],
2623 | [
2624 | 0.2,
2625 | "#de77ae"
2626 | ],
2627 | [
2628 | 0.3,
2629 | "#f1b6da"
2630 | ],
2631 | [
2632 | 0.4,
2633 | "#fde0ef"
2634 | ],
2635 | [
2636 | 0.5,
2637 | "#f7f7f7"
2638 | ],
2639 | [
2640 | 0.6,
2641 | "#e6f5d0"
2642 | ],
2643 | [
2644 | 0.7,
2645 | "#b8e186"
2646 | ],
2647 | [
2648 | 0.8,
2649 | "#7fbc41"
2650 | ],
2651 | [
2652 | 0.9,
2653 | "#4d9221"
2654 | ],
2655 | [
2656 | 1,
2657 | "#276419"
2658 | ]
2659 | ],
2660 | "sequential": [
2661 | [
2662 | 0,
2663 | "#0d0887"
2664 | ],
2665 | [
2666 | 0.1111111111111111,
2667 | "#46039f"
2668 | ],
2669 | [
2670 | 0.2222222222222222,
2671 | "#7201a8"
2672 | ],
2673 | [
2674 | 0.3333333333333333,
2675 | "#9c179e"
2676 | ],
2677 | [
2678 | 0.4444444444444444,
2679 | "#bd3786"
2680 | ],
2681 | [
2682 | 0.5555555555555556,
2683 | "#d8576b"
2684 | ],
2685 | [
2686 | 0.6666666666666666,
2687 | "#ed7953"
2688 | ],
2689 | [
2690 | 0.7777777777777778,
2691 | "#fb9f3a"
2692 | ],
2693 | [
2694 | 0.8888888888888888,
2695 | "#fdca26"
2696 | ],
2697 | [
2698 | 1,
2699 | "#f0f921"
2700 | ]
2701 | ],
2702 | "sequentialminus": [
2703 | [
2704 | 0,
2705 | "#0d0887"
2706 | ],
2707 | [
2708 | 0.1111111111111111,
2709 | "#46039f"
2710 | ],
2711 | [
2712 | 0.2222222222222222,
2713 | "#7201a8"
2714 | ],
2715 | [
2716 | 0.3333333333333333,
2717 | "#9c179e"
2718 | ],
2719 | [
2720 | 0.4444444444444444,
2721 | "#bd3786"
2722 | ],
2723 | [
2724 | 0.5555555555555556,
2725 | "#d8576b"
2726 | ],
2727 | [
2728 | 0.6666666666666666,
2729 | "#ed7953"
2730 | ],
2731 | [
2732 | 0.7777777777777778,
2733 | "#fb9f3a"
2734 | ],
2735 | [
2736 | 0.8888888888888888,
2737 | "#fdca26"
2738 | ],
2739 | [
2740 | 1,
2741 | "#f0f921"
2742 | ]
2743 | ]
2744 | },
2745 | "colorway": [
2746 | "#636efa",
2747 | "#EF553B",
2748 | "#00cc96",
2749 | "#ab63fa",
2750 | "#FFA15A",
2751 | "#19d3f3",
2752 | "#FF6692",
2753 | "#B6E880",
2754 | "#FF97FF",
2755 | "#FECB52"
2756 | ],
2757 | "font": {
2758 | "color": "#2a3f5f"
2759 | },
2760 | "geo": {
2761 | "bgcolor": "white",
2762 | "lakecolor": "white",
2763 | "landcolor": "white",
2764 | "showlakes": true,
2765 | "showland": true,
2766 | "subunitcolor": "#C8D4E3"
2767 | },
2768 | "hoverlabel": {
2769 | "align": "left"
2770 | },
2771 | "hovermode": "closest",
2772 | "mapbox": {
2773 | "style": "light"
2774 | },
2775 | "paper_bgcolor": "white",
2776 | "plot_bgcolor": "white",
2777 | "polar": {
2778 | "angularaxis": {
2779 | "gridcolor": "#EBF0F8",
2780 | "linecolor": "#EBF0F8",
2781 | "ticks": ""
2782 | },
2783 | "bgcolor": "white",
2784 | "radialaxis": {
2785 | "gridcolor": "#EBF0F8",
2786 | "linecolor": "#EBF0F8",
2787 | "ticks": ""
2788 | }
2789 | },
2790 | "scene": {
2791 | "xaxis": {
2792 | "backgroundcolor": "white",
2793 | "gridcolor": "#DFE8F3",
2794 | "gridwidth": 2,
2795 | "linecolor": "#EBF0F8",
2796 | "showbackground": true,
2797 | "ticks": "",
2798 | "zerolinecolor": "#EBF0F8"
2799 | },
2800 | "yaxis": {
2801 | "backgroundcolor": "white",
2802 | "gridcolor": "#DFE8F3",
2803 | "gridwidth": 2,
2804 | "linecolor": "#EBF0F8",
2805 | "showbackground": true,
2806 | "ticks": "",
2807 | "zerolinecolor": "#EBF0F8"
2808 | },
2809 | "zaxis": {
2810 | "backgroundcolor": "white",
2811 | "gridcolor": "#DFE8F3",
2812 | "gridwidth": 2,
2813 | "linecolor": "#EBF0F8",
2814 | "showbackground": true,
2815 | "ticks": "",
2816 | "zerolinecolor": "#EBF0F8"
2817 | }
2818 | },
2819 | "shapedefaults": {
2820 | "line": {
2821 | "color": "#2a3f5f"
2822 | }
2823 | },
2824 | "ternary": {
2825 | "aaxis": {
2826 | "gridcolor": "#DFE8F3",
2827 | "linecolor": "#A2B1C6",
2828 | "ticks": ""
2829 | },
2830 | "baxis": {
2831 | "gridcolor": "#DFE8F3",
2832 | "linecolor": "#A2B1C6",
2833 | "ticks": ""
2834 | },
2835 | "bgcolor": "white",
2836 | "caxis": {
2837 | "gridcolor": "#DFE8F3",
2838 | "linecolor": "#A2B1C6",
2839 | "ticks": ""
2840 | }
2841 | },
2842 | "title": {
2843 | "x": 0.05
2844 | },
2845 | "xaxis": {
2846 | "automargin": true,
2847 | "gridcolor": "#EBF0F8",
2848 | "linecolor": "#EBF0F8",
2849 | "ticks": "",
2850 | "title": {
2851 | "standoff": 15
2852 | },
2853 | "zerolinecolor": "#EBF0F8",
2854 | "zerolinewidth": 2
2855 | },
2856 | "yaxis": {
2857 | "automargin": true,
2858 | "gridcolor": "#EBF0F8",
2859 | "linecolor": "#EBF0F8",
2860 | "ticks": "",
2861 | "title": {
2862 | "standoff": 15
2863 | },
2864 | "zerolinecolor": "#EBF0F8",
2865 | "zerolinewidth": 2
2866 | }
2867 | }
2868 | },
2869 | "title": {
2870 | "text": "Total Viewership Hours by Release Month (2023)"
2871 | },
2872 | "width": 1000,
2873 | "xaxis": {
2874 | "tickmode": "array",
2875 | "ticktext": [
2876 | "Jan",
2877 | "Feb",
2878 | "Mar",
2879 | "Apr",
2880 | "May",
2881 | "Jun",
2882 | "Jul",
2883 | "Aug",
2884 | "Sep",
2885 | "Oct",
2886 | "Nov",
2887 | "Dec"
2888 | ],
2889 | "tickvals": [
2890 | 1,
2891 | 2,
2892 | 3,
2893 | 4,
2894 | 5,
2895 | 6,
2896 | 7,
2897 | 8,
2898 | 9,
2899 | 10,
2900 | 11,
2901 | 12
2902 | ],
2903 | "title": {
2904 | "text": "Month"
2905 | }
2906 | },
2907 | "yaxis": {
2908 | "title": {
2909 | "text": "Total Hours Viewed (in billions)"
2910 | }
2911 | }
2912 | }
2913 | }
2914 | },
2915 | "metadata": {},
2916 | "output_type": "display_data"
2917 | }
2918 | ],
2919 | "source": [
2920 | "# convert the \"Release Date\" to a datetime format and extract the month\n",
2921 | "netflix_data['Release Date'] = pd.to_datetime(netflix_data['Release Date'])\n",
2922 | "netflix_data['Release Month'] = netflix_data['Release Date'].dt.month\n",
2923 | "\n",
2924 | "# aggregate viewership hours by release month\n",
2925 | "monthly_viewership = netflix_data.groupby('Release Month')['Hours Viewed'].sum()\n",
2926 | "\n",
2927 | "fig = go.Figure(data=[\n",
2928 | " go.Scatter(\n",
2929 | " x=monthly_viewership.index,\n",
2930 | " y=monthly_viewership.values,\n",
2931 | " mode='lines+markers',\n",
2932 | " marker=dict(color='blue'),\n",
2933 | " line=dict(color='blue')\n",
2934 | " )\n",
2935 | "])\n",
2936 | "\n",
2937 | "fig.update_layout(\n",
2938 | " title='Total Viewership Hours by Release Month (2023)',\n",
2939 | " xaxis_title='Month',\n",
2940 | " yaxis_title='Total Hours Viewed (in billions)',\n",
2941 | " xaxis=dict(\n",
2942 | " tickmode='array',\n",
2943 | " tickvals=list(range(1, 13)),\n",
2944 | " ticktext=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n",
2945 | " ),\n",
2946 | " height=600,\n",
2947 | " width=1000\n",
2948 | ")\n",
2949 | "\n",
2950 | "fig.show()"
2951 | ]
2952 | },
2953 | {
2954 | "cell_type": "code",
2955 | "execution_count": 7,
2956 | "id": "d0d550e3",
2957 | "metadata": {},
2958 | "outputs": [
2959 | {
2960 | "data": {
2961 | "text/html": [
2962 | "\n",
2963 | "\n",
2976 | "
\n",
2977 | " \n",
2978 | " \n",
2979 | " | \n",
2980 | " Title | \n",
2981 | " Hours Viewed | \n",
2982 | " Language Indicator | \n",
2983 | " Content Type | \n",
2984 | " Release Date | \n",
2985 | "
\n",
2986 | " \n",
2987 | " \n",
2988 | " \n",
2989 | " | 0 | \n",
2990 | " The Night Agent: Season 1 | \n",
2991 | " 812100000.0 | \n",
2992 | " English | \n",
2993 | " Show | \n",
2994 | " 2023-03-23 | \n",
2995 | "
\n",
2996 | " \n",
2997 | " | 1 | \n",
2998 | " Ginny & Georgia: Season 2 | \n",
2999 | " 665100000.0 | \n",
3000 | " English | \n",
3001 | " Show | \n",
3002 | " 2023-01-05 | \n",
3003 | "
\n",
3004 | " \n",
3005 | " | 18227 | \n",
3006 | " King the Land: Limited Series // 킹더랜드: 리미티드 시리즈 | \n",
3007 | " 630200000.0 | \n",
3008 | " Korean | \n",
3009 | " Movie | \n",
3010 | " 2023-06-17 | \n",
3011 | "
\n",
3012 | " \n",
3013 | " | 2 | \n",
3014 | " The Glory: Season 1 // 더 글로리: 시즌 1 | \n",
3015 | " 622800000.0 | \n",
3016 | " Korean | \n",
3017 | " Show | \n",
3018 | " 2022-12-30 | \n",
3019 | "
\n",
3020 | " \n",
3021 | " | 18214 | \n",
3022 | " ONE PIECE: Season 1 | \n",
3023 | " 541900000.0 | \n",
3024 | " English | \n",
3025 | " Show | \n",
3026 | " 2023-08-31 | \n",
3027 | "
\n",
3028 | " \n",
3029 | "
\n",
3030 | "
"
3031 | ],
3032 | "text/plain": [
3033 | " Title Hours Viewed \\\n",
3034 | "0 The Night Agent: Season 1 812100000.0 \n",
3035 | "1 Ginny & Georgia: Season 2 665100000.0 \n",
3036 | "18227 King the Land: Limited Series // 킹더랜드: 리미티드 시리즈 630200000.0 \n",
3037 | "2 The Glory: Season 1 // 더 글로리: 시즌 1 622800000.0 \n",
3038 | "18214 ONE PIECE: Season 1 541900000.0 \n",
3039 | "\n",
3040 | " Language Indicator Content Type Release Date \n",
3041 | "0 English Show 2023-03-23 \n",
3042 | "1 English Show 2023-01-05 \n",
3043 | "18227 Korean Movie 2023-06-17 \n",
3044 | "2 Korean Show 2022-12-30 \n",
3045 | "18214 English Show 2023-08-31 "
3046 | ]
3047 | },
3048 | "execution_count": 7,
3049 | "metadata": {},
3050 | "output_type": "execute_result"
3051 | }
3052 | ],
3053 | "source": [
3054 | "# extract the top 5 titles based on viewership hours\n",
3055 | "top_5_titles = netflix_data.nlargest(5, 'Hours Viewed')\n",
3056 | "\n",
3057 | "top_5_titles[['Title', 'Hours Viewed', 'Language Indicator', 'Content Type', 'Release Date']]"
3058 | ]
3059 | },
3060 | {
3061 | "cell_type": "code",
3062 | "execution_count": 8,
3063 | "id": "4d0a906d",
3064 | "metadata": {},
3065 | "outputs": [
3066 | {
3067 | "data": {
3068 | "application/vnd.plotly.v1+json": {
3069 | "config": {
3070 | "plotlyServerURL": "https://plot.ly"
3071 | },
3072 | "data": [
3073 | {
3074 | "mode": "lines+markers",
3075 | "name": "Movie",
3076 | "type": "scatter",
3077 | "x": [
3078 | 1,
3079 | 2,
3080 | 3,
3081 | 4,
3082 | 5,
3083 | 6,
3084 | 7,
3085 | 8,
3086 | 9,
3087 | 10,
3088 | 11,
3089 | 12
3090 | ],
3091 | "y": [
3092 | 2275900000,
3093 | 1654400000,
3094 | 2109400000,
3095 | 2757600000,
3096 | 2520500000,
3097 | 3135800000,
3098 | 1615700000,
3099 | 2186400000,
3100 | 2092300000,
3101 | 3400400000,
3102 | 1866900000,
3103 | 2554900000
3104 | ]
3105 | },
3106 | {
3107 | "mode": "lines+markers",
3108 | "name": "Show",
3109 | "type": "scatter",
3110 | "x": [
3111 | 1,
3112 | 2,
3113 | 3,
3114 | 4,
3115 | 5,
3116 | 6,
3117 | 7,
3118 | 8,
3119 | 9,
3120 | 10,
3121 | 11,
3122 | 12
3123 | ],
3124 | "y": [
3125 | 4995700000,
3126 | 5449300000,
3127 | 5327700000,
3128 | 4108100000,
3129 | 4574100000,
3130 | 5386200000,
3131 | 4909100000,
3132 | 4631400000,
3133 | 5169900000,
3134 | 4722800000,
3135 | 5882600000,
3136 | 7500900000
3137 | ]
3138 | }
3139 | ],
3140 | "layout": {
3141 | "height": 600,
3142 | "legend": {
3143 | "title": {
3144 | "text": "Content Type"
3145 | }
3146 | },
3147 | "template": {
3148 | "data": {
3149 | "bar": [
3150 | {
3151 | "error_x": {
3152 | "color": "#2a3f5f"
3153 | },
3154 | "error_y": {
3155 | "color": "#2a3f5f"
3156 | },
3157 | "marker": {
3158 | "line": {
3159 | "color": "white",
3160 | "width": 0.5
3161 | },
3162 | "pattern": {
3163 | "fillmode": "overlay",
3164 | "size": 10,
3165 | "solidity": 0.2
3166 | }
3167 | },
3168 | "type": "bar"
3169 | }
3170 | ],
3171 | "barpolar": [
3172 | {
3173 | "marker": {
3174 | "line": {
3175 | "color": "white",
3176 | "width": 0.5
3177 | },
3178 | "pattern": {
3179 | "fillmode": "overlay",
3180 | "size": 10,
3181 | "solidity": 0.2
3182 | }
3183 | },
3184 | "type": "barpolar"
3185 | }
3186 | ],
3187 | "carpet": [
3188 | {
3189 | "aaxis": {
3190 | "endlinecolor": "#2a3f5f",
3191 | "gridcolor": "#C8D4E3",
3192 | "linecolor": "#C8D4E3",
3193 | "minorgridcolor": "#C8D4E3",
3194 | "startlinecolor": "#2a3f5f"
3195 | },
3196 | "baxis": {
3197 | "endlinecolor": "#2a3f5f",
3198 | "gridcolor": "#C8D4E3",
3199 | "linecolor": "#C8D4E3",
3200 | "minorgridcolor": "#C8D4E3",
3201 | "startlinecolor": "#2a3f5f"
3202 | },
3203 | "type": "carpet"
3204 | }
3205 | ],
3206 | "choropleth": [
3207 | {
3208 | "colorbar": {
3209 | "outlinewidth": 0,
3210 | "ticks": ""
3211 | },
3212 | "type": "choropleth"
3213 | }
3214 | ],
3215 | "contour": [
3216 | {
3217 | "colorbar": {
3218 | "outlinewidth": 0,
3219 | "ticks": ""
3220 | },
3221 | "colorscale": [
3222 | [
3223 | 0,
3224 | "#0d0887"
3225 | ],
3226 | [
3227 | 0.1111111111111111,
3228 | "#46039f"
3229 | ],
3230 | [
3231 | 0.2222222222222222,
3232 | "#7201a8"
3233 | ],
3234 | [
3235 | 0.3333333333333333,
3236 | "#9c179e"
3237 | ],
3238 | [
3239 | 0.4444444444444444,
3240 | "#bd3786"
3241 | ],
3242 | [
3243 | 0.5555555555555556,
3244 | "#d8576b"
3245 | ],
3246 | [
3247 | 0.6666666666666666,
3248 | "#ed7953"
3249 | ],
3250 | [
3251 | 0.7777777777777778,
3252 | "#fb9f3a"
3253 | ],
3254 | [
3255 | 0.8888888888888888,
3256 | "#fdca26"
3257 | ],
3258 | [
3259 | 1,
3260 | "#f0f921"
3261 | ]
3262 | ],
3263 | "type": "contour"
3264 | }
3265 | ],
3266 | "contourcarpet": [
3267 | {
3268 | "colorbar": {
3269 | "outlinewidth": 0,
3270 | "ticks": ""
3271 | },
3272 | "type": "contourcarpet"
3273 | }
3274 | ],
3275 | "heatmap": [
3276 | {
3277 | "colorbar": {
3278 | "outlinewidth": 0,
3279 | "ticks": ""
3280 | },
3281 | "colorscale": [
3282 | [
3283 | 0,
3284 | "#0d0887"
3285 | ],
3286 | [
3287 | 0.1111111111111111,
3288 | "#46039f"
3289 | ],
3290 | [
3291 | 0.2222222222222222,
3292 | "#7201a8"
3293 | ],
3294 | [
3295 | 0.3333333333333333,
3296 | "#9c179e"
3297 | ],
3298 | [
3299 | 0.4444444444444444,
3300 | "#bd3786"
3301 | ],
3302 | [
3303 | 0.5555555555555556,
3304 | "#d8576b"
3305 | ],
3306 | [
3307 | 0.6666666666666666,
3308 | "#ed7953"
3309 | ],
3310 | [
3311 | 0.7777777777777778,
3312 | "#fb9f3a"
3313 | ],
3314 | [
3315 | 0.8888888888888888,
3316 | "#fdca26"
3317 | ],
3318 | [
3319 | 1,
3320 | "#f0f921"
3321 | ]
3322 | ],
3323 | "type": "heatmap"
3324 | }
3325 | ],
3326 | "heatmapgl": [
3327 | {
3328 | "colorbar": {
3329 | "outlinewidth": 0,
3330 | "ticks": ""
3331 | },
3332 | "colorscale": [
3333 | [
3334 | 0,
3335 | "#0d0887"
3336 | ],
3337 | [
3338 | 0.1111111111111111,
3339 | "#46039f"
3340 | ],
3341 | [
3342 | 0.2222222222222222,
3343 | "#7201a8"
3344 | ],
3345 | [
3346 | 0.3333333333333333,
3347 | "#9c179e"
3348 | ],
3349 | [
3350 | 0.4444444444444444,
3351 | "#bd3786"
3352 | ],
3353 | [
3354 | 0.5555555555555556,
3355 | "#d8576b"
3356 | ],
3357 | [
3358 | 0.6666666666666666,
3359 | "#ed7953"
3360 | ],
3361 | [
3362 | 0.7777777777777778,
3363 | "#fb9f3a"
3364 | ],
3365 | [
3366 | 0.8888888888888888,
3367 | "#fdca26"
3368 | ],
3369 | [
3370 | 1,
3371 | "#f0f921"
3372 | ]
3373 | ],
3374 | "type": "heatmapgl"
3375 | }
3376 | ],
3377 | "histogram": [
3378 | {
3379 | "marker": {
3380 | "pattern": {
3381 | "fillmode": "overlay",
3382 | "size": 10,
3383 | "solidity": 0.2
3384 | }
3385 | },
3386 | "type": "histogram"
3387 | }
3388 | ],
3389 | "histogram2d": [
3390 | {
3391 | "colorbar": {
3392 | "outlinewidth": 0,
3393 | "ticks": ""
3394 | },
3395 | "colorscale": [
3396 | [
3397 | 0,
3398 | "#0d0887"
3399 | ],
3400 | [
3401 | 0.1111111111111111,
3402 | "#46039f"
3403 | ],
3404 | [
3405 | 0.2222222222222222,
3406 | "#7201a8"
3407 | ],
3408 | [
3409 | 0.3333333333333333,
3410 | "#9c179e"
3411 | ],
3412 | [
3413 | 0.4444444444444444,
3414 | "#bd3786"
3415 | ],
3416 | [
3417 | 0.5555555555555556,
3418 | "#d8576b"
3419 | ],
3420 | [
3421 | 0.6666666666666666,
3422 | "#ed7953"
3423 | ],
3424 | [
3425 | 0.7777777777777778,
3426 | "#fb9f3a"
3427 | ],
3428 | [
3429 | 0.8888888888888888,
3430 | "#fdca26"
3431 | ],
3432 | [
3433 | 1,
3434 | "#f0f921"
3435 | ]
3436 | ],
3437 | "type": "histogram2d"
3438 | }
3439 | ],
3440 | "histogram2dcontour": [
3441 | {
3442 | "colorbar": {
3443 | "outlinewidth": 0,
3444 | "ticks": ""
3445 | },
3446 | "colorscale": [
3447 | [
3448 | 0,
3449 | "#0d0887"
3450 | ],
3451 | [
3452 | 0.1111111111111111,
3453 | "#46039f"
3454 | ],
3455 | [
3456 | 0.2222222222222222,
3457 | "#7201a8"
3458 | ],
3459 | [
3460 | 0.3333333333333333,
3461 | "#9c179e"
3462 | ],
3463 | [
3464 | 0.4444444444444444,
3465 | "#bd3786"
3466 | ],
3467 | [
3468 | 0.5555555555555556,
3469 | "#d8576b"
3470 | ],
3471 | [
3472 | 0.6666666666666666,
3473 | "#ed7953"
3474 | ],
3475 | [
3476 | 0.7777777777777778,
3477 | "#fb9f3a"
3478 | ],
3479 | [
3480 | 0.8888888888888888,
3481 | "#fdca26"
3482 | ],
3483 | [
3484 | 1,
3485 | "#f0f921"
3486 | ]
3487 | ],
3488 | "type": "histogram2dcontour"
3489 | }
3490 | ],
3491 | "mesh3d": [
3492 | {
3493 | "colorbar": {
3494 | "outlinewidth": 0,
3495 | "ticks": ""
3496 | },
3497 | "type": "mesh3d"
3498 | }
3499 | ],
3500 | "parcoords": [
3501 | {
3502 | "line": {
3503 | "colorbar": {
3504 | "outlinewidth": 0,
3505 | "ticks": ""
3506 | }
3507 | },
3508 | "type": "parcoords"
3509 | }
3510 | ],
3511 | "pie": [
3512 | {
3513 | "automargin": true,
3514 | "type": "pie"
3515 | }
3516 | ],
3517 | "scatter": [
3518 | {
3519 | "fillpattern": {
3520 | "fillmode": "overlay",
3521 | "size": 10,
3522 | "solidity": 0.2
3523 | },
3524 | "type": "scatter"
3525 | }
3526 | ],
3527 | "scatter3d": [
3528 | {
3529 | "line": {
3530 | "colorbar": {
3531 | "outlinewidth": 0,
3532 | "ticks": ""
3533 | }
3534 | },
3535 | "marker": {
3536 | "colorbar": {
3537 | "outlinewidth": 0,
3538 | "ticks": ""
3539 | }
3540 | },
3541 | "type": "scatter3d"
3542 | }
3543 | ],
3544 | "scattercarpet": [
3545 | {
3546 | "marker": {
3547 | "colorbar": {
3548 | "outlinewidth": 0,
3549 | "ticks": ""
3550 | }
3551 | },
3552 | "type": "scattercarpet"
3553 | }
3554 | ],
3555 | "scattergeo": [
3556 | {
3557 | "marker": {
3558 | "colorbar": {
3559 | "outlinewidth": 0,
3560 | "ticks": ""
3561 | }
3562 | },
3563 | "type": "scattergeo"
3564 | }
3565 | ],
3566 | "scattergl": [
3567 | {
3568 | "marker": {
3569 | "colorbar": {
3570 | "outlinewidth": 0,
3571 | "ticks": ""
3572 | }
3573 | },
3574 | "type": "scattergl"
3575 | }
3576 | ],
3577 | "scattermapbox": [
3578 | {
3579 | "marker": {
3580 | "colorbar": {
3581 | "outlinewidth": 0,
3582 | "ticks": ""
3583 | }
3584 | },
3585 | "type": "scattermapbox"
3586 | }
3587 | ],
3588 | "scatterpolar": [
3589 | {
3590 | "marker": {
3591 | "colorbar": {
3592 | "outlinewidth": 0,
3593 | "ticks": ""
3594 | }
3595 | },
3596 | "type": "scatterpolar"
3597 | }
3598 | ],
3599 | "scatterpolargl": [
3600 | {
3601 | "marker": {
3602 | "colorbar": {
3603 | "outlinewidth": 0,
3604 | "ticks": ""
3605 | }
3606 | },
3607 | "type": "scatterpolargl"
3608 | }
3609 | ],
3610 | "scatterternary": [
3611 | {
3612 | "marker": {
3613 | "colorbar": {
3614 | "outlinewidth": 0,
3615 | "ticks": ""
3616 | }
3617 | },
3618 | "type": "scatterternary"
3619 | }
3620 | ],
3621 | "surface": [
3622 | {
3623 | "colorbar": {
3624 | "outlinewidth": 0,
3625 | "ticks": ""
3626 | },
3627 | "colorscale": [
3628 | [
3629 | 0,
3630 | "#0d0887"
3631 | ],
3632 | [
3633 | 0.1111111111111111,
3634 | "#46039f"
3635 | ],
3636 | [
3637 | 0.2222222222222222,
3638 | "#7201a8"
3639 | ],
3640 | [
3641 | 0.3333333333333333,
3642 | "#9c179e"
3643 | ],
3644 | [
3645 | 0.4444444444444444,
3646 | "#bd3786"
3647 | ],
3648 | [
3649 | 0.5555555555555556,
3650 | "#d8576b"
3651 | ],
3652 | [
3653 | 0.6666666666666666,
3654 | "#ed7953"
3655 | ],
3656 | [
3657 | 0.7777777777777778,
3658 | "#fb9f3a"
3659 | ],
3660 | [
3661 | 0.8888888888888888,
3662 | "#fdca26"
3663 | ],
3664 | [
3665 | 1,
3666 | "#f0f921"
3667 | ]
3668 | ],
3669 | "type": "surface"
3670 | }
3671 | ],
3672 | "table": [
3673 | {
3674 | "cells": {
3675 | "fill": {
3676 | "color": "#EBF0F8"
3677 | },
3678 | "line": {
3679 | "color": "white"
3680 | }
3681 | },
3682 | "header": {
3683 | "fill": {
3684 | "color": "#C8D4E3"
3685 | },
3686 | "line": {
3687 | "color": "white"
3688 | }
3689 | },
3690 | "type": "table"
3691 | }
3692 | ]
3693 | },
3694 | "layout": {
3695 | "annotationdefaults": {
3696 | "arrowcolor": "#2a3f5f",
3697 | "arrowhead": 0,
3698 | "arrowwidth": 1
3699 | },
3700 | "autotypenumbers": "strict",
3701 | "coloraxis": {
3702 | "colorbar": {
3703 | "outlinewidth": 0,
3704 | "ticks": ""
3705 | }
3706 | },
3707 | "colorscale": {
3708 | "diverging": [
3709 | [
3710 | 0,
3711 | "#8e0152"
3712 | ],
3713 | [
3714 | 0.1,
3715 | "#c51b7d"
3716 | ],
3717 | [
3718 | 0.2,
3719 | "#de77ae"
3720 | ],
3721 | [
3722 | 0.3,
3723 | "#f1b6da"
3724 | ],
3725 | [
3726 | 0.4,
3727 | "#fde0ef"
3728 | ],
3729 | [
3730 | 0.5,
3731 | "#f7f7f7"
3732 | ],
3733 | [
3734 | 0.6,
3735 | "#e6f5d0"
3736 | ],
3737 | [
3738 | 0.7,
3739 | "#b8e186"
3740 | ],
3741 | [
3742 | 0.8,
3743 | "#7fbc41"
3744 | ],
3745 | [
3746 | 0.9,
3747 | "#4d9221"
3748 | ],
3749 | [
3750 | 1,
3751 | "#276419"
3752 | ]
3753 | ],
3754 | "sequential": [
3755 | [
3756 | 0,
3757 | "#0d0887"
3758 | ],
3759 | [
3760 | 0.1111111111111111,
3761 | "#46039f"
3762 | ],
3763 | [
3764 | 0.2222222222222222,
3765 | "#7201a8"
3766 | ],
3767 | [
3768 | 0.3333333333333333,
3769 | "#9c179e"
3770 | ],
3771 | [
3772 | 0.4444444444444444,
3773 | "#bd3786"
3774 | ],
3775 | [
3776 | 0.5555555555555556,
3777 | "#d8576b"
3778 | ],
3779 | [
3780 | 0.6666666666666666,
3781 | "#ed7953"
3782 | ],
3783 | [
3784 | 0.7777777777777778,
3785 | "#fb9f3a"
3786 | ],
3787 | [
3788 | 0.8888888888888888,
3789 | "#fdca26"
3790 | ],
3791 | [
3792 | 1,
3793 | "#f0f921"
3794 | ]
3795 | ],
3796 | "sequentialminus": [
3797 | [
3798 | 0,
3799 | "#0d0887"
3800 | ],
3801 | [
3802 | 0.1111111111111111,
3803 | "#46039f"
3804 | ],
3805 | [
3806 | 0.2222222222222222,
3807 | "#7201a8"
3808 | ],
3809 | [
3810 | 0.3333333333333333,
3811 | "#9c179e"
3812 | ],
3813 | [
3814 | 0.4444444444444444,
3815 | "#bd3786"
3816 | ],
3817 | [
3818 | 0.5555555555555556,
3819 | "#d8576b"
3820 | ],
3821 | [
3822 | 0.6666666666666666,
3823 | "#ed7953"
3824 | ],
3825 | [
3826 | 0.7777777777777778,
3827 | "#fb9f3a"
3828 | ],
3829 | [
3830 | 0.8888888888888888,
3831 | "#fdca26"
3832 | ],
3833 | [
3834 | 1,
3835 | "#f0f921"
3836 | ]
3837 | ]
3838 | },
3839 | "colorway": [
3840 | "#636efa",
3841 | "#EF553B",
3842 | "#00cc96",
3843 | "#ab63fa",
3844 | "#FFA15A",
3845 | "#19d3f3",
3846 | "#FF6692",
3847 | "#B6E880",
3848 | "#FF97FF",
3849 | "#FECB52"
3850 | ],
3851 | "font": {
3852 | "color": "#2a3f5f"
3853 | },
3854 | "geo": {
3855 | "bgcolor": "white",
3856 | "lakecolor": "white",
3857 | "landcolor": "white",
3858 | "showlakes": true,
3859 | "showland": true,
3860 | "subunitcolor": "#C8D4E3"
3861 | },
3862 | "hoverlabel": {
3863 | "align": "left"
3864 | },
3865 | "hovermode": "closest",
3866 | "mapbox": {
3867 | "style": "light"
3868 | },
3869 | "paper_bgcolor": "white",
3870 | "plot_bgcolor": "white",
3871 | "polar": {
3872 | "angularaxis": {
3873 | "gridcolor": "#EBF0F8",
3874 | "linecolor": "#EBF0F8",
3875 | "ticks": ""
3876 | },
3877 | "bgcolor": "white",
3878 | "radialaxis": {
3879 | "gridcolor": "#EBF0F8",
3880 | "linecolor": "#EBF0F8",
3881 | "ticks": ""
3882 | }
3883 | },
3884 | "scene": {
3885 | "xaxis": {
3886 | "backgroundcolor": "white",
3887 | "gridcolor": "#DFE8F3",
3888 | "gridwidth": 2,
3889 | "linecolor": "#EBF0F8",
3890 | "showbackground": true,
3891 | "ticks": "",
3892 | "zerolinecolor": "#EBF0F8"
3893 | },
3894 | "yaxis": {
3895 | "backgroundcolor": "white",
3896 | "gridcolor": "#DFE8F3",
3897 | "gridwidth": 2,
3898 | "linecolor": "#EBF0F8",
3899 | "showbackground": true,
3900 | "ticks": "",
3901 | "zerolinecolor": "#EBF0F8"
3902 | },
3903 | "zaxis": {
3904 | "backgroundcolor": "white",
3905 | "gridcolor": "#DFE8F3",
3906 | "gridwidth": 2,
3907 | "linecolor": "#EBF0F8",
3908 | "showbackground": true,
3909 | "ticks": "",
3910 | "zerolinecolor": "#EBF0F8"
3911 | }
3912 | },
3913 | "shapedefaults": {
3914 | "line": {
3915 | "color": "#2a3f5f"
3916 | }
3917 | },
3918 | "ternary": {
3919 | "aaxis": {
3920 | "gridcolor": "#DFE8F3",
3921 | "linecolor": "#A2B1C6",
3922 | "ticks": ""
3923 | },
3924 | "baxis": {
3925 | "gridcolor": "#DFE8F3",
3926 | "linecolor": "#A2B1C6",
3927 | "ticks": ""
3928 | },
3929 | "bgcolor": "white",
3930 | "caxis": {
3931 | "gridcolor": "#DFE8F3",
3932 | "linecolor": "#A2B1C6",
3933 | "ticks": ""
3934 | }
3935 | },
3936 | "title": {
3937 | "x": 0.05
3938 | },
3939 | "xaxis": {
3940 | "automargin": true,
3941 | "gridcolor": "#EBF0F8",
3942 | "linecolor": "#EBF0F8",
3943 | "ticks": "",
3944 | "title": {
3945 | "standoff": 15
3946 | },
3947 | "zerolinecolor": "#EBF0F8",
3948 | "zerolinewidth": 2
3949 | },
3950 | "yaxis": {
3951 | "automargin": true,
3952 | "gridcolor": "#EBF0F8",
3953 | "linecolor": "#EBF0F8",
3954 | "ticks": "",
3955 | "title": {
3956 | "standoff": 15
3957 | },
3958 | "zerolinecolor": "#EBF0F8",
3959 | "zerolinewidth": 2
3960 | }
3961 | }
3962 | },
3963 | "title": {
3964 | "text": "Viewership Trends by Content Type and Release Month (2023)"
3965 | },
3966 | "width": 1000,
3967 | "xaxis": {
3968 | "tickmode": "array",
3969 | "ticktext": [
3970 | "Jan",
3971 | "Feb",
3972 | "Mar",
3973 | "Apr",
3974 | "May",
3975 | "Jun",
3976 | "Jul",
3977 | "Aug",
3978 | "Sep",
3979 | "Oct",
3980 | "Nov",
3981 | "Dec"
3982 | ],
3983 | "tickvals": [
3984 | 1,
3985 | 2,
3986 | 3,
3987 | 4,
3988 | 5,
3989 | 6,
3990 | 7,
3991 | 8,
3992 | 9,
3993 | 10,
3994 | 11,
3995 | 12
3996 | ],
3997 | "title": {
3998 | "text": "Month"
3999 | }
4000 | },
4001 | "yaxis": {
4002 | "title": {
4003 | "text": "Total Hours Viewed (in billions)"
4004 | }
4005 | }
4006 | }
4007 | }
4008 | },
4009 | "metadata": {},
4010 | "output_type": "display_data"
4011 | }
4012 | ],
4013 | "source": [
4014 | "# aggregate viewership hours by content type and release month\n",
4015 | "monthly_viewership_by_type = netflix_data.pivot_table(index='Release Month',\n",
4016 | " columns='Content Type',\n",
4017 | " values='Hours Viewed',\n",
4018 | " aggfunc='sum')\n",
4019 | "\n",
4020 | "fig = go.Figure()\n",
4021 | "\n",
4022 | "for content_type in monthly_viewership_by_type.columns:\n",
4023 | " fig.add_trace(\n",
4024 | " go.Scatter(\n",
4025 | " x=monthly_viewership_by_type.index,\n",
4026 | " y=monthly_viewership_by_type[content_type],\n",
4027 | " mode='lines+markers',\n",
4028 | " name=content_type\n",
4029 | " )\n",
4030 | " )\n",
4031 | "\n",
4032 | "fig.update_layout(\n",
4033 | " title='Viewership Trends by Content Type and Release Month (2023)',\n",
4034 | " xaxis_title='Month',\n",
4035 | " yaxis_title='Total Hours Viewed (in billions)',\n",
4036 | " xaxis=dict(\n",
4037 | " tickmode='array',\n",
4038 | " tickvals=list(range(1, 13)),\n",
4039 | " ticktext=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n",
4040 | " ),\n",
4041 | " height=600,\n",
4042 | " width=1000,\n",
4043 | " legend_title='Content Type'\n",
4044 | ")\n",
4045 | "\n",
4046 | "fig.show()"
4047 | ]
4048 | },
4049 | {
4050 | "cell_type": "code",
4051 | "execution_count": 9,
4052 | "id": "c15d34ed",
4053 | "metadata": {},
4054 | "outputs": [
4055 | {
4056 | "data": {
4057 | "application/vnd.plotly.v1+json": {
4058 | "config": {
4059 | "plotlyServerURL": "https://plot.ly"
4060 | },
4061 | "data": [
4062 | {
4063 | "marker": {
4064 | "color": "orange"
4065 | },
4066 | "type": "bar",
4067 | "x": [
4068 | "Winter",
4069 | "Spring",
4070 | "Summer",
4071 | "Fall"
4072 | ],
4073 | "y": [
4074 | 24431100000,
4075 | 21397400000,
4076 | 21864600000,
4077 | 90708800000
4078 | ]
4079 | }
4080 | ],
4081 | "layout": {
4082 | "height": 500,
4083 | "template": {
4084 | "data": {
4085 | "bar": [
4086 | {
4087 | "error_x": {
4088 | "color": "#2a3f5f"
4089 | },
4090 | "error_y": {
4091 | "color": "#2a3f5f"
4092 | },
4093 | "marker": {
4094 | "line": {
4095 | "color": "white",
4096 | "width": 0.5
4097 | },
4098 | "pattern": {
4099 | "fillmode": "overlay",
4100 | "size": 10,
4101 | "solidity": 0.2
4102 | }
4103 | },
4104 | "type": "bar"
4105 | }
4106 | ],
4107 | "barpolar": [
4108 | {
4109 | "marker": {
4110 | "line": {
4111 | "color": "white",
4112 | "width": 0.5
4113 | },
4114 | "pattern": {
4115 | "fillmode": "overlay",
4116 | "size": 10,
4117 | "solidity": 0.2
4118 | }
4119 | },
4120 | "type": "barpolar"
4121 | }
4122 | ],
4123 | "carpet": [
4124 | {
4125 | "aaxis": {
4126 | "endlinecolor": "#2a3f5f",
4127 | "gridcolor": "#C8D4E3",
4128 | "linecolor": "#C8D4E3",
4129 | "minorgridcolor": "#C8D4E3",
4130 | "startlinecolor": "#2a3f5f"
4131 | },
4132 | "baxis": {
4133 | "endlinecolor": "#2a3f5f",
4134 | "gridcolor": "#C8D4E3",
4135 | "linecolor": "#C8D4E3",
4136 | "minorgridcolor": "#C8D4E3",
4137 | "startlinecolor": "#2a3f5f"
4138 | },
4139 | "type": "carpet"
4140 | }
4141 | ],
4142 | "choropleth": [
4143 | {
4144 | "colorbar": {
4145 | "outlinewidth": 0,
4146 | "ticks": ""
4147 | },
4148 | "type": "choropleth"
4149 | }
4150 | ],
4151 | "contour": [
4152 | {
4153 | "colorbar": {
4154 | "outlinewidth": 0,
4155 | "ticks": ""
4156 | },
4157 | "colorscale": [
4158 | [
4159 | 0,
4160 | "#0d0887"
4161 | ],
4162 | [
4163 | 0.1111111111111111,
4164 | "#46039f"
4165 | ],
4166 | [
4167 | 0.2222222222222222,
4168 | "#7201a8"
4169 | ],
4170 | [
4171 | 0.3333333333333333,
4172 | "#9c179e"
4173 | ],
4174 | [
4175 | 0.4444444444444444,
4176 | "#bd3786"
4177 | ],
4178 | [
4179 | 0.5555555555555556,
4180 | "#d8576b"
4181 | ],
4182 | [
4183 | 0.6666666666666666,
4184 | "#ed7953"
4185 | ],
4186 | [
4187 | 0.7777777777777778,
4188 | "#fb9f3a"
4189 | ],
4190 | [
4191 | 0.8888888888888888,
4192 | "#fdca26"
4193 | ],
4194 | [
4195 | 1,
4196 | "#f0f921"
4197 | ]
4198 | ],
4199 | "type": "contour"
4200 | }
4201 | ],
4202 | "contourcarpet": [
4203 | {
4204 | "colorbar": {
4205 | "outlinewidth": 0,
4206 | "ticks": ""
4207 | },
4208 | "type": "contourcarpet"
4209 | }
4210 | ],
4211 | "heatmap": [
4212 | {
4213 | "colorbar": {
4214 | "outlinewidth": 0,
4215 | "ticks": ""
4216 | },
4217 | "colorscale": [
4218 | [
4219 | 0,
4220 | "#0d0887"
4221 | ],
4222 | [
4223 | 0.1111111111111111,
4224 | "#46039f"
4225 | ],
4226 | [
4227 | 0.2222222222222222,
4228 | "#7201a8"
4229 | ],
4230 | [
4231 | 0.3333333333333333,
4232 | "#9c179e"
4233 | ],
4234 | [
4235 | 0.4444444444444444,
4236 | "#bd3786"
4237 | ],
4238 | [
4239 | 0.5555555555555556,
4240 | "#d8576b"
4241 | ],
4242 | [
4243 | 0.6666666666666666,
4244 | "#ed7953"
4245 | ],
4246 | [
4247 | 0.7777777777777778,
4248 | "#fb9f3a"
4249 | ],
4250 | [
4251 | 0.8888888888888888,
4252 | "#fdca26"
4253 | ],
4254 | [
4255 | 1,
4256 | "#f0f921"
4257 | ]
4258 | ],
4259 | "type": "heatmap"
4260 | }
4261 | ],
4262 | "heatmapgl": [
4263 | {
4264 | "colorbar": {
4265 | "outlinewidth": 0,
4266 | "ticks": ""
4267 | },
4268 | "colorscale": [
4269 | [
4270 | 0,
4271 | "#0d0887"
4272 | ],
4273 | [
4274 | 0.1111111111111111,
4275 | "#46039f"
4276 | ],
4277 | [
4278 | 0.2222222222222222,
4279 | "#7201a8"
4280 | ],
4281 | [
4282 | 0.3333333333333333,
4283 | "#9c179e"
4284 | ],
4285 | [
4286 | 0.4444444444444444,
4287 | "#bd3786"
4288 | ],
4289 | [
4290 | 0.5555555555555556,
4291 | "#d8576b"
4292 | ],
4293 | [
4294 | 0.6666666666666666,
4295 | "#ed7953"
4296 | ],
4297 | [
4298 | 0.7777777777777778,
4299 | "#fb9f3a"
4300 | ],
4301 | [
4302 | 0.8888888888888888,
4303 | "#fdca26"
4304 | ],
4305 | [
4306 | 1,
4307 | "#f0f921"
4308 | ]
4309 | ],
4310 | "type": "heatmapgl"
4311 | }
4312 | ],
4313 | "histogram": [
4314 | {
4315 | "marker": {
4316 | "pattern": {
4317 | "fillmode": "overlay",
4318 | "size": 10,
4319 | "solidity": 0.2
4320 | }
4321 | },
4322 | "type": "histogram"
4323 | }
4324 | ],
4325 | "histogram2d": [
4326 | {
4327 | "colorbar": {
4328 | "outlinewidth": 0,
4329 | "ticks": ""
4330 | },
4331 | "colorscale": [
4332 | [
4333 | 0,
4334 | "#0d0887"
4335 | ],
4336 | [
4337 | 0.1111111111111111,
4338 | "#46039f"
4339 | ],
4340 | [
4341 | 0.2222222222222222,
4342 | "#7201a8"
4343 | ],
4344 | [
4345 | 0.3333333333333333,
4346 | "#9c179e"
4347 | ],
4348 | [
4349 | 0.4444444444444444,
4350 | "#bd3786"
4351 | ],
4352 | [
4353 | 0.5555555555555556,
4354 | "#d8576b"
4355 | ],
4356 | [
4357 | 0.6666666666666666,
4358 | "#ed7953"
4359 | ],
4360 | [
4361 | 0.7777777777777778,
4362 | "#fb9f3a"
4363 | ],
4364 | [
4365 | 0.8888888888888888,
4366 | "#fdca26"
4367 | ],
4368 | [
4369 | 1,
4370 | "#f0f921"
4371 | ]
4372 | ],
4373 | "type": "histogram2d"
4374 | }
4375 | ],
4376 | "histogram2dcontour": [
4377 | {
4378 | "colorbar": {
4379 | "outlinewidth": 0,
4380 | "ticks": ""
4381 | },
4382 | "colorscale": [
4383 | [
4384 | 0,
4385 | "#0d0887"
4386 | ],
4387 | [
4388 | 0.1111111111111111,
4389 | "#46039f"
4390 | ],
4391 | [
4392 | 0.2222222222222222,
4393 | "#7201a8"
4394 | ],
4395 | [
4396 | 0.3333333333333333,
4397 | "#9c179e"
4398 | ],
4399 | [
4400 | 0.4444444444444444,
4401 | "#bd3786"
4402 | ],
4403 | [
4404 | 0.5555555555555556,
4405 | "#d8576b"
4406 | ],
4407 | [
4408 | 0.6666666666666666,
4409 | "#ed7953"
4410 | ],
4411 | [
4412 | 0.7777777777777778,
4413 | "#fb9f3a"
4414 | ],
4415 | [
4416 | 0.8888888888888888,
4417 | "#fdca26"
4418 | ],
4419 | [
4420 | 1,
4421 | "#f0f921"
4422 | ]
4423 | ],
4424 | "type": "histogram2dcontour"
4425 | }
4426 | ],
4427 | "mesh3d": [
4428 | {
4429 | "colorbar": {
4430 | "outlinewidth": 0,
4431 | "ticks": ""
4432 | },
4433 | "type": "mesh3d"
4434 | }
4435 | ],
4436 | "parcoords": [
4437 | {
4438 | "line": {
4439 | "colorbar": {
4440 | "outlinewidth": 0,
4441 | "ticks": ""
4442 | }
4443 | },
4444 | "type": "parcoords"
4445 | }
4446 | ],
4447 | "pie": [
4448 | {
4449 | "automargin": true,
4450 | "type": "pie"
4451 | }
4452 | ],
4453 | "scatter": [
4454 | {
4455 | "fillpattern": {
4456 | "fillmode": "overlay",
4457 | "size": 10,
4458 | "solidity": 0.2
4459 | },
4460 | "type": "scatter"
4461 | }
4462 | ],
4463 | "scatter3d": [
4464 | {
4465 | "line": {
4466 | "colorbar": {
4467 | "outlinewidth": 0,
4468 | "ticks": ""
4469 | }
4470 | },
4471 | "marker": {
4472 | "colorbar": {
4473 | "outlinewidth": 0,
4474 | "ticks": ""
4475 | }
4476 | },
4477 | "type": "scatter3d"
4478 | }
4479 | ],
4480 | "scattercarpet": [
4481 | {
4482 | "marker": {
4483 | "colorbar": {
4484 | "outlinewidth": 0,
4485 | "ticks": ""
4486 | }
4487 | },
4488 | "type": "scattercarpet"
4489 | }
4490 | ],
4491 | "scattergeo": [
4492 | {
4493 | "marker": {
4494 | "colorbar": {
4495 | "outlinewidth": 0,
4496 | "ticks": ""
4497 | }
4498 | },
4499 | "type": "scattergeo"
4500 | }
4501 | ],
4502 | "scattergl": [
4503 | {
4504 | "marker": {
4505 | "colorbar": {
4506 | "outlinewidth": 0,
4507 | "ticks": ""
4508 | }
4509 | },
4510 | "type": "scattergl"
4511 | }
4512 | ],
4513 | "scattermapbox": [
4514 | {
4515 | "marker": {
4516 | "colorbar": {
4517 | "outlinewidth": 0,
4518 | "ticks": ""
4519 | }
4520 | },
4521 | "type": "scattermapbox"
4522 | }
4523 | ],
4524 | "scatterpolar": [
4525 | {
4526 | "marker": {
4527 | "colorbar": {
4528 | "outlinewidth": 0,
4529 | "ticks": ""
4530 | }
4531 | },
4532 | "type": "scatterpolar"
4533 | }
4534 | ],
4535 | "scatterpolargl": [
4536 | {
4537 | "marker": {
4538 | "colorbar": {
4539 | "outlinewidth": 0,
4540 | "ticks": ""
4541 | }
4542 | },
4543 | "type": "scatterpolargl"
4544 | }
4545 | ],
4546 | "scatterternary": [
4547 | {
4548 | "marker": {
4549 | "colorbar": {
4550 | "outlinewidth": 0,
4551 | "ticks": ""
4552 | }
4553 | },
4554 | "type": "scatterternary"
4555 | }
4556 | ],
4557 | "surface": [
4558 | {
4559 | "colorbar": {
4560 | "outlinewidth": 0,
4561 | "ticks": ""
4562 | },
4563 | "colorscale": [
4564 | [
4565 | 0,
4566 | "#0d0887"
4567 | ],
4568 | [
4569 | 0.1111111111111111,
4570 | "#46039f"
4571 | ],
4572 | [
4573 | 0.2222222222222222,
4574 | "#7201a8"
4575 | ],
4576 | [
4577 | 0.3333333333333333,
4578 | "#9c179e"
4579 | ],
4580 | [
4581 | 0.4444444444444444,
4582 | "#bd3786"
4583 | ],
4584 | [
4585 | 0.5555555555555556,
4586 | "#d8576b"
4587 | ],
4588 | [
4589 | 0.6666666666666666,
4590 | "#ed7953"
4591 | ],
4592 | [
4593 | 0.7777777777777778,
4594 | "#fb9f3a"
4595 | ],
4596 | [
4597 | 0.8888888888888888,
4598 | "#fdca26"
4599 | ],
4600 | [
4601 | 1,
4602 | "#f0f921"
4603 | ]
4604 | ],
4605 | "type": "surface"
4606 | }
4607 | ],
4608 | "table": [
4609 | {
4610 | "cells": {
4611 | "fill": {
4612 | "color": "#EBF0F8"
4613 | },
4614 | "line": {
4615 | "color": "white"
4616 | }
4617 | },
4618 | "header": {
4619 | "fill": {
4620 | "color": "#C8D4E3"
4621 | },
4622 | "line": {
4623 | "color": "white"
4624 | }
4625 | },
4626 | "type": "table"
4627 | }
4628 | ]
4629 | },
4630 | "layout": {
4631 | "annotationdefaults": {
4632 | "arrowcolor": "#2a3f5f",
4633 | "arrowhead": 0,
4634 | "arrowwidth": 1
4635 | },
4636 | "autotypenumbers": "strict",
4637 | "coloraxis": {
4638 | "colorbar": {
4639 | "outlinewidth": 0,
4640 | "ticks": ""
4641 | }
4642 | },
4643 | "colorscale": {
4644 | "diverging": [
4645 | [
4646 | 0,
4647 | "#8e0152"
4648 | ],
4649 | [
4650 | 0.1,
4651 | "#c51b7d"
4652 | ],
4653 | [
4654 | 0.2,
4655 | "#de77ae"
4656 | ],
4657 | [
4658 | 0.3,
4659 | "#f1b6da"
4660 | ],
4661 | [
4662 | 0.4,
4663 | "#fde0ef"
4664 | ],
4665 | [
4666 | 0.5,
4667 | "#f7f7f7"
4668 | ],
4669 | [
4670 | 0.6,
4671 | "#e6f5d0"
4672 | ],
4673 | [
4674 | 0.7,
4675 | "#b8e186"
4676 | ],
4677 | [
4678 | 0.8,
4679 | "#7fbc41"
4680 | ],
4681 | [
4682 | 0.9,
4683 | "#4d9221"
4684 | ],
4685 | [
4686 | 1,
4687 | "#276419"
4688 | ]
4689 | ],
4690 | "sequential": [
4691 | [
4692 | 0,
4693 | "#0d0887"
4694 | ],
4695 | [
4696 | 0.1111111111111111,
4697 | "#46039f"
4698 | ],
4699 | [
4700 | 0.2222222222222222,
4701 | "#7201a8"
4702 | ],
4703 | [
4704 | 0.3333333333333333,
4705 | "#9c179e"
4706 | ],
4707 | [
4708 | 0.4444444444444444,
4709 | "#bd3786"
4710 | ],
4711 | [
4712 | 0.5555555555555556,
4713 | "#d8576b"
4714 | ],
4715 | [
4716 | 0.6666666666666666,
4717 | "#ed7953"
4718 | ],
4719 | [
4720 | 0.7777777777777778,
4721 | "#fb9f3a"
4722 | ],
4723 | [
4724 | 0.8888888888888888,
4725 | "#fdca26"
4726 | ],
4727 | [
4728 | 1,
4729 | "#f0f921"
4730 | ]
4731 | ],
4732 | "sequentialminus": [
4733 | [
4734 | 0,
4735 | "#0d0887"
4736 | ],
4737 | [
4738 | 0.1111111111111111,
4739 | "#46039f"
4740 | ],
4741 | [
4742 | 0.2222222222222222,
4743 | "#7201a8"
4744 | ],
4745 | [
4746 | 0.3333333333333333,
4747 | "#9c179e"
4748 | ],
4749 | [
4750 | 0.4444444444444444,
4751 | "#bd3786"
4752 | ],
4753 | [
4754 | 0.5555555555555556,
4755 | "#d8576b"
4756 | ],
4757 | [
4758 | 0.6666666666666666,
4759 | "#ed7953"
4760 | ],
4761 | [
4762 | 0.7777777777777778,
4763 | "#fb9f3a"
4764 | ],
4765 | [
4766 | 0.8888888888888888,
4767 | "#fdca26"
4768 | ],
4769 | [
4770 | 1,
4771 | "#f0f921"
4772 | ]
4773 | ]
4774 | },
4775 | "colorway": [
4776 | "#636efa",
4777 | "#EF553B",
4778 | "#00cc96",
4779 | "#ab63fa",
4780 | "#FFA15A",
4781 | "#19d3f3",
4782 | "#FF6692",
4783 | "#B6E880",
4784 | "#FF97FF",
4785 | "#FECB52"
4786 | ],
4787 | "font": {
4788 | "color": "#2a3f5f"
4789 | },
4790 | "geo": {
4791 | "bgcolor": "white",
4792 | "lakecolor": "white",
4793 | "landcolor": "white",
4794 | "showlakes": true,
4795 | "showland": true,
4796 | "subunitcolor": "#C8D4E3"
4797 | },
4798 | "hoverlabel": {
4799 | "align": "left"
4800 | },
4801 | "hovermode": "closest",
4802 | "mapbox": {
4803 | "style": "light"
4804 | },
4805 | "paper_bgcolor": "white",
4806 | "plot_bgcolor": "white",
4807 | "polar": {
4808 | "angularaxis": {
4809 | "gridcolor": "#EBF0F8",
4810 | "linecolor": "#EBF0F8",
4811 | "ticks": ""
4812 | },
4813 | "bgcolor": "white",
4814 | "radialaxis": {
4815 | "gridcolor": "#EBF0F8",
4816 | "linecolor": "#EBF0F8",
4817 | "ticks": ""
4818 | }
4819 | },
4820 | "scene": {
4821 | "xaxis": {
4822 | "backgroundcolor": "white",
4823 | "gridcolor": "#DFE8F3",
4824 | "gridwidth": 2,
4825 | "linecolor": "#EBF0F8",
4826 | "showbackground": true,
4827 | "ticks": "",
4828 | "zerolinecolor": "#EBF0F8"
4829 | },
4830 | "yaxis": {
4831 | "backgroundcolor": "white",
4832 | "gridcolor": "#DFE8F3",
4833 | "gridwidth": 2,
4834 | "linecolor": "#EBF0F8",
4835 | "showbackground": true,
4836 | "ticks": "",
4837 | "zerolinecolor": "#EBF0F8"
4838 | },
4839 | "zaxis": {
4840 | "backgroundcolor": "white",
4841 | "gridcolor": "#DFE8F3",
4842 | "gridwidth": 2,
4843 | "linecolor": "#EBF0F8",
4844 | "showbackground": true,
4845 | "ticks": "",
4846 | "zerolinecolor": "#EBF0F8"
4847 | }
4848 | },
4849 | "shapedefaults": {
4850 | "line": {
4851 | "color": "#2a3f5f"
4852 | }
4853 | },
4854 | "ternary": {
4855 | "aaxis": {
4856 | "gridcolor": "#DFE8F3",
4857 | "linecolor": "#A2B1C6",
4858 | "ticks": ""
4859 | },
4860 | "baxis": {
4861 | "gridcolor": "#DFE8F3",
4862 | "linecolor": "#A2B1C6",
4863 | "ticks": ""
4864 | },
4865 | "bgcolor": "white",
4866 | "caxis": {
4867 | "gridcolor": "#DFE8F3",
4868 | "linecolor": "#A2B1C6",
4869 | "ticks": ""
4870 | }
4871 | },
4872 | "title": {
4873 | "x": 0.05
4874 | },
4875 | "xaxis": {
4876 | "automargin": true,
4877 | "gridcolor": "#EBF0F8",
4878 | "linecolor": "#EBF0F8",
4879 | "ticks": "",
4880 | "title": {
4881 | "standoff": 15
4882 | },
4883 | "zerolinecolor": "#EBF0F8",
4884 | "zerolinewidth": 2
4885 | },
4886 | "yaxis": {
4887 | "automargin": true,
4888 | "gridcolor": "#EBF0F8",
4889 | "linecolor": "#EBF0F8",
4890 | "ticks": "",
4891 | "title": {
4892 | "standoff": 15
4893 | },
4894 | "zerolinecolor": "#EBF0F8",
4895 | "zerolinewidth": 2
4896 | }
4897 | }
4898 | },
4899 | "title": {
4900 | "text": "Total Viewership Hours by Release Season (2023)"
4901 | },
4902 | "width": 800,
4903 | "xaxis": {
4904 | "categoryarray": [
4905 | "Winter",
4906 | "Spring",
4907 | "Summer",
4908 | "Fall"
4909 | ],
4910 | "categoryorder": "array",
4911 | "tickangle": 0,
4912 | "title": {
4913 | "text": "Season"
4914 | }
4915 | },
4916 | "yaxis": {
4917 | "title": {
4918 | "text": "Total Hours Viewed (in billions)"
4919 | }
4920 | }
4921 | }
4922 | }
4923 | },
4924 | "metadata": {},
4925 | "output_type": "display_data"
4926 | }
4927 | ],
4928 | "source": [
4929 | "# define seasons based on release months\n",
4930 | "def get_season(month):\n",
4931 | " if month in [12, 1, 2]:\n",
4932 | " return 'Winter'\n",
4933 | " elif month in [3, 4, 5]:\n",
4934 | " return 'Spring'\n",
4935 | " elif month in [6, 7, 8]:\n",
4936 | " return 'Summer'\n",
4937 | " else:\n",
4938 | " return 'Fall'\n",
4939 | "\n",
4940 | "# apply the season categorization to the dataset\n",
4941 | "netflix_data['Release Season'] = netflix_data['Release Month'].apply(get_season)\n",
4942 | "\n",
4943 | "# aggregate viewership hours by release season\n",
4944 | "seasonal_viewership = netflix_data.groupby('Release Season')['Hours Viewed'].sum()\n",
4945 | "\n",
4946 | "# order the seasons as 'Winter', 'Spring', 'Summer', 'Fall'\n",
4947 | "seasons_order = ['Winter', 'Spring', 'Summer', 'Fall']\n",
4948 | "seasonal_viewership = seasonal_viewership.reindex(seasons_order)\n",
4949 | "\n",
4950 | "fig = go.Figure(data=[\n",
4951 | " go.Bar(\n",
4952 | " x=seasonal_viewership.index,\n",
4953 | " y=seasonal_viewership.values,\n",
4954 | " marker_color='orange'\n",
4955 | " )\n",
4956 | "])\n",
4957 | "\n",
4958 | "fig.update_layout(\n",
4959 | " title='Total Viewership Hours by Release Season (2023)',\n",
4960 | " xaxis_title='Season',\n",
4961 | " yaxis_title='Total Hours Viewed (in billions)',\n",
4962 | " xaxis_tickangle=0,\n",
4963 | " height=500,\n",
4964 | " width=800,\n",
4965 | " xaxis=dict(\n",
4966 | " categoryorder='array',\n",
4967 | " categoryarray=seasons_order\n",
4968 | " )\n",
4969 | ")\n",
4970 | "\n",
4971 | "fig.show()"
4972 | ]
4973 | },
4974 | {
4975 | "cell_type": "code",
4976 | "execution_count": 10,
4977 | "id": "c78bda4a",
4978 | "metadata": {},
4979 | "outputs": [
4980 | {
4981 | "data": {
4982 | "application/vnd.plotly.v1+json": {
4983 | "config": {
4984 | "plotlyServerURL": "https://plot.ly"
4985 | },
4986 | "data": [
4987 | {
4988 | "marker": {
4989 | "color": "goldenrod"
4990 | },
4991 | "name": "Number of Releases",
4992 | "opacity": 0.7,
4993 | "type": "bar",
4994 | "x": [
4995 | 1,
4996 | 2,
4997 | 3,
4998 | 4,
4999 | 5,
5000 | 6,
5001 | 7,
5002 | 8,
5003 | 9,
5004 | 10,
5005 | 11,
5006 | 12
5007 | ],
5008 | "y": [
5009 | 608,
5010 | 560,
5011 | 690,
5012 | 647,
5013 | 624,
5014 | 670,
5015 | 631,
5016 | 674,
5017 | 739,
5018 | 802,
5019 | 734,
5020 | 787
5021 | ],
5022 | "yaxis": "y"
5023 | },
5024 | {
5025 | "line": {
5026 | "color": "red"
5027 | },
5028 | "marker": {
5029 | "color": "red"
5030 | },
5031 | "mode": "lines+markers",
5032 | "name": "Viewership Hours",
5033 | "type": "scatter",
5034 | "x": [
5035 | 1,
5036 | 2,
5037 | 3,
5038 | 4,
5039 | 5,
5040 | 6,
5041 | 7,
5042 | 8,
5043 | 9,
5044 | 10,
5045 | 11,
5046 | 12
5047 | ],
5048 | "y": [
5049 | 7271600000,
5050 | 7103700000,
5051 | 7437100000,
5052 | 6865700000,
5053 | 7094600000,
5054 | 8522000000,
5055 | 6524800000,
5056 | 6817800000,
5057 | 7262200000,
5058 | 8123200000,
5059 | 7749500000,
5060 | 10055800000
5061 | ],
5062 | "yaxis": "y2"
5063 | }
5064 | ],
5065 | "layout": {
5066 | "height": 600,
5067 | "legend": {
5068 | "orientation": "v",
5069 | "x": 1.05,
5070 | "xanchor": "left",
5071 | "y": 1
5072 | },
5073 | "template": {
5074 | "data": {
5075 | "bar": [
5076 | {
5077 | "error_x": {
5078 | "color": "#2a3f5f"
5079 | },
5080 | "error_y": {
5081 | "color": "#2a3f5f"
5082 | },
5083 | "marker": {
5084 | "line": {
5085 | "color": "white",
5086 | "width": 0.5
5087 | },
5088 | "pattern": {
5089 | "fillmode": "overlay",
5090 | "size": 10,
5091 | "solidity": 0.2
5092 | }
5093 | },
5094 | "type": "bar"
5095 | }
5096 | ],
5097 | "barpolar": [
5098 | {
5099 | "marker": {
5100 | "line": {
5101 | "color": "white",
5102 | "width": 0.5
5103 | },
5104 | "pattern": {
5105 | "fillmode": "overlay",
5106 | "size": 10,
5107 | "solidity": 0.2
5108 | }
5109 | },
5110 | "type": "barpolar"
5111 | }
5112 | ],
5113 | "carpet": [
5114 | {
5115 | "aaxis": {
5116 | "endlinecolor": "#2a3f5f",
5117 | "gridcolor": "#C8D4E3",
5118 | "linecolor": "#C8D4E3",
5119 | "minorgridcolor": "#C8D4E3",
5120 | "startlinecolor": "#2a3f5f"
5121 | },
5122 | "baxis": {
5123 | "endlinecolor": "#2a3f5f",
5124 | "gridcolor": "#C8D4E3",
5125 | "linecolor": "#C8D4E3",
5126 | "minorgridcolor": "#C8D4E3",
5127 | "startlinecolor": "#2a3f5f"
5128 | },
5129 | "type": "carpet"
5130 | }
5131 | ],
5132 | "choropleth": [
5133 | {
5134 | "colorbar": {
5135 | "outlinewidth": 0,
5136 | "ticks": ""
5137 | },
5138 | "type": "choropleth"
5139 | }
5140 | ],
5141 | "contour": [
5142 | {
5143 | "colorbar": {
5144 | "outlinewidth": 0,
5145 | "ticks": ""
5146 | },
5147 | "colorscale": [
5148 | [
5149 | 0,
5150 | "#0d0887"
5151 | ],
5152 | [
5153 | 0.1111111111111111,
5154 | "#46039f"
5155 | ],
5156 | [
5157 | 0.2222222222222222,
5158 | "#7201a8"
5159 | ],
5160 | [
5161 | 0.3333333333333333,
5162 | "#9c179e"
5163 | ],
5164 | [
5165 | 0.4444444444444444,
5166 | "#bd3786"
5167 | ],
5168 | [
5169 | 0.5555555555555556,
5170 | "#d8576b"
5171 | ],
5172 | [
5173 | 0.6666666666666666,
5174 | "#ed7953"
5175 | ],
5176 | [
5177 | 0.7777777777777778,
5178 | "#fb9f3a"
5179 | ],
5180 | [
5181 | 0.8888888888888888,
5182 | "#fdca26"
5183 | ],
5184 | [
5185 | 1,
5186 | "#f0f921"
5187 | ]
5188 | ],
5189 | "type": "contour"
5190 | }
5191 | ],
5192 | "contourcarpet": [
5193 | {
5194 | "colorbar": {
5195 | "outlinewidth": 0,
5196 | "ticks": ""
5197 | },
5198 | "type": "contourcarpet"
5199 | }
5200 | ],
5201 | "heatmap": [
5202 | {
5203 | "colorbar": {
5204 | "outlinewidth": 0,
5205 | "ticks": ""
5206 | },
5207 | "colorscale": [
5208 | [
5209 | 0,
5210 | "#0d0887"
5211 | ],
5212 | [
5213 | 0.1111111111111111,
5214 | "#46039f"
5215 | ],
5216 | [
5217 | 0.2222222222222222,
5218 | "#7201a8"
5219 | ],
5220 | [
5221 | 0.3333333333333333,
5222 | "#9c179e"
5223 | ],
5224 | [
5225 | 0.4444444444444444,
5226 | "#bd3786"
5227 | ],
5228 | [
5229 | 0.5555555555555556,
5230 | "#d8576b"
5231 | ],
5232 | [
5233 | 0.6666666666666666,
5234 | "#ed7953"
5235 | ],
5236 | [
5237 | 0.7777777777777778,
5238 | "#fb9f3a"
5239 | ],
5240 | [
5241 | 0.8888888888888888,
5242 | "#fdca26"
5243 | ],
5244 | [
5245 | 1,
5246 | "#f0f921"
5247 | ]
5248 | ],
5249 | "type": "heatmap"
5250 | }
5251 | ],
5252 | "heatmapgl": [
5253 | {
5254 | "colorbar": {
5255 | "outlinewidth": 0,
5256 | "ticks": ""
5257 | },
5258 | "colorscale": [
5259 | [
5260 | 0,
5261 | "#0d0887"
5262 | ],
5263 | [
5264 | 0.1111111111111111,
5265 | "#46039f"
5266 | ],
5267 | [
5268 | 0.2222222222222222,
5269 | "#7201a8"
5270 | ],
5271 | [
5272 | 0.3333333333333333,
5273 | "#9c179e"
5274 | ],
5275 | [
5276 | 0.4444444444444444,
5277 | "#bd3786"
5278 | ],
5279 | [
5280 | 0.5555555555555556,
5281 | "#d8576b"
5282 | ],
5283 | [
5284 | 0.6666666666666666,
5285 | "#ed7953"
5286 | ],
5287 | [
5288 | 0.7777777777777778,
5289 | "#fb9f3a"
5290 | ],
5291 | [
5292 | 0.8888888888888888,
5293 | "#fdca26"
5294 | ],
5295 | [
5296 | 1,
5297 | "#f0f921"
5298 | ]
5299 | ],
5300 | "type": "heatmapgl"
5301 | }
5302 | ],
5303 | "histogram": [
5304 | {
5305 | "marker": {
5306 | "pattern": {
5307 | "fillmode": "overlay",
5308 | "size": 10,
5309 | "solidity": 0.2
5310 | }
5311 | },
5312 | "type": "histogram"
5313 | }
5314 | ],
5315 | "histogram2d": [
5316 | {
5317 | "colorbar": {
5318 | "outlinewidth": 0,
5319 | "ticks": ""
5320 | },
5321 | "colorscale": [
5322 | [
5323 | 0,
5324 | "#0d0887"
5325 | ],
5326 | [
5327 | 0.1111111111111111,
5328 | "#46039f"
5329 | ],
5330 | [
5331 | 0.2222222222222222,
5332 | "#7201a8"
5333 | ],
5334 | [
5335 | 0.3333333333333333,
5336 | "#9c179e"
5337 | ],
5338 | [
5339 | 0.4444444444444444,
5340 | "#bd3786"
5341 | ],
5342 | [
5343 | 0.5555555555555556,
5344 | "#d8576b"
5345 | ],
5346 | [
5347 | 0.6666666666666666,
5348 | "#ed7953"
5349 | ],
5350 | [
5351 | 0.7777777777777778,
5352 | "#fb9f3a"
5353 | ],
5354 | [
5355 | 0.8888888888888888,
5356 | "#fdca26"
5357 | ],
5358 | [
5359 | 1,
5360 | "#f0f921"
5361 | ]
5362 | ],
5363 | "type": "histogram2d"
5364 | }
5365 | ],
5366 | "histogram2dcontour": [
5367 | {
5368 | "colorbar": {
5369 | "outlinewidth": 0,
5370 | "ticks": ""
5371 | },
5372 | "colorscale": [
5373 | [
5374 | 0,
5375 | "#0d0887"
5376 | ],
5377 | [
5378 | 0.1111111111111111,
5379 | "#46039f"
5380 | ],
5381 | [
5382 | 0.2222222222222222,
5383 | "#7201a8"
5384 | ],
5385 | [
5386 | 0.3333333333333333,
5387 | "#9c179e"
5388 | ],
5389 | [
5390 | 0.4444444444444444,
5391 | "#bd3786"
5392 | ],
5393 | [
5394 | 0.5555555555555556,
5395 | "#d8576b"
5396 | ],
5397 | [
5398 | 0.6666666666666666,
5399 | "#ed7953"
5400 | ],
5401 | [
5402 | 0.7777777777777778,
5403 | "#fb9f3a"
5404 | ],
5405 | [
5406 | 0.8888888888888888,
5407 | "#fdca26"
5408 | ],
5409 | [
5410 | 1,
5411 | "#f0f921"
5412 | ]
5413 | ],
5414 | "type": "histogram2dcontour"
5415 | }
5416 | ],
5417 | "mesh3d": [
5418 | {
5419 | "colorbar": {
5420 | "outlinewidth": 0,
5421 | "ticks": ""
5422 | },
5423 | "type": "mesh3d"
5424 | }
5425 | ],
5426 | "parcoords": [
5427 | {
5428 | "line": {
5429 | "colorbar": {
5430 | "outlinewidth": 0,
5431 | "ticks": ""
5432 | }
5433 | },
5434 | "type": "parcoords"
5435 | }
5436 | ],
5437 | "pie": [
5438 | {
5439 | "automargin": true,
5440 | "type": "pie"
5441 | }
5442 | ],
5443 | "scatter": [
5444 | {
5445 | "fillpattern": {
5446 | "fillmode": "overlay",
5447 | "size": 10,
5448 | "solidity": 0.2
5449 | },
5450 | "type": "scatter"
5451 | }
5452 | ],
5453 | "scatter3d": [
5454 | {
5455 | "line": {
5456 | "colorbar": {
5457 | "outlinewidth": 0,
5458 | "ticks": ""
5459 | }
5460 | },
5461 | "marker": {
5462 | "colorbar": {
5463 | "outlinewidth": 0,
5464 | "ticks": ""
5465 | }
5466 | },
5467 | "type": "scatter3d"
5468 | }
5469 | ],
5470 | "scattercarpet": [
5471 | {
5472 | "marker": {
5473 | "colorbar": {
5474 | "outlinewidth": 0,
5475 | "ticks": ""
5476 | }
5477 | },
5478 | "type": "scattercarpet"
5479 | }
5480 | ],
5481 | "scattergeo": [
5482 | {
5483 | "marker": {
5484 | "colorbar": {
5485 | "outlinewidth": 0,
5486 | "ticks": ""
5487 | }
5488 | },
5489 | "type": "scattergeo"
5490 | }
5491 | ],
5492 | "scattergl": [
5493 | {
5494 | "marker": {
5495 | "colorbar": {
5496 | "outlinewidth": 0,
5497 | "ticks": ""
5498 | }
5499 | },
5500 | "type": "scattergl"
5501 | }
5502 | ],
5503 | "scattermapbox": [
5504 | {
5505 | "marker": {
5506 | "colorbar": {
5507 | "outlinewidth": 0,
5508 | "ticks": ""
5509 | }
5510 | },
5511 | "type": "scattermapbox"
5512 | }
5513 | ],
5514 | "scatterpolar": [
5515 | {
5516 | "marker": {
5517 | "colorbar": {
5518 | "outlinewidth": 0,
5519 | "ticks": ""
5520 | }
5521 | },
5522 | "type": "scatterpolar"
5523 | }
5524 | ],
5525 | "scatterpolargl": [
5526 | {
5527 | "marker": {
5528 | "colorbar": {
5529 | "outlinewidth": 0,
5530 | "ticks": ""
5531 | }
5532 | },
5533 | "type": "scatterpolargl"
5534 | }
5535 | ],
5536 | "scatterternary": [
5537 | {
5538 | "marker": {
5539 | "colorbar": {
5540 | "outlinewidth": 0,
5541 | "ticks": ""
5542 | }
5543 | },
5544 | "type": "scatterternary"
5545 | }
5546 | ],
5547 | "surface": [
5548 | {
5549 | "colorbar": {
5550 | "outlinewidth": 0,
5551 | "ticks": ""
5552 | },
5553 | "colorscale": [
5554 | [
5555 | 0,
5556 | "#0d0887"
5557 | ],
5558 | [
5559 | 0.1111111111111111,
5560 | "#46039f"
5561 | ],
5562 | [
5563 | 0.2222222222222222,
5564 | "#7201a8"
5565 | ],
5566 | [
5567 | 0.3333333333333333,
5568 | "#9c179e"
5569 | ],
5570 | [
5571 | 0.4444444444444444,
5572 | "#bd3786"
5573 | ],
5574 | [
5575 | 0.5555555555555556,
5576 | "#d8576b"
5577 | ],
5578 | [
5579 | 0.6666666666666666,
5580 | "#ed7953"
5581 | ],
5582 | [
5583 | 0.7777777777777778,
5584 | "#fb9f3a"
5585 | ],
5586 | [
5587 | 0.8888888888888888,
5588 | "#fdca26"
5589 | ],
5590 | [
5591 | 1,
5592 | "#f0f921"
5593 | ]
5594 | ],
5595 | "type": "surface"
5596 | }
5597 | ],
5598 | "table": [
5599 | {
5600 | "cells": {
5601 | "fill": {
5602 | "color": "#EBF0F8"
5603 | },
5604 | "line": {
5605 | "color": "white"
5606 | }
5607 | },
5608 | "header": {
5609 | "fill": {
5610 | "color": "#C8D4E3"
5611 | },
5612 | "line": {
5613 | "color": "white"
5614 | }
5615 | },
5616 | "type": "table"
5617 | }
5618 | ]
5619 | },
5620 | "layout": {
5621 | "annotationdefaults": {
5622 | "arrowcolor": "#2a3f5f",
5623 | "arrowhead": 0,
5624 | "arrowwidth": 1
5625 | },
5626 | "autotypenumbers": "strict",
5627 | "coloraxis": {
5628 | "colorbar": {
5629 | "outlinewidth": 0,
5630 | "ticks": ""
5631 | }
5632 | },
5633 | "colorscale": {
5634 | "diverging": [
5635 | [
5636 | 0,
5637 | "#8e0152"
5638 | ],
5639 | [
5640 | 0.1,
5641 | "#c51b7d"
5642 | ],
5643 | [
5644 | 0.2,
5645 | "#de77ae"
5646 | ],
5647 | [
5648 | 0.3,
5649 | "#f1b6da"
5650 | ],
5651 | [
5652 | 0.4,
5653 | "#fde0ef"
5654 | ],
5655 | [
5656 | 0.5,
5657 | "#f7f7f7"
5658 | ],
5659 | [
5660 | 0.6,
5661 | "#e6f5d0"
5662 | ],
5663 | [
5664 | 0.7,
5665 | "#b8e186"
5666 | ],
5667 | [
5668 | 0.8,
5669 | "#7fbc41"
5670 | ],
5671 | [
5672 | 0.9,
5673 | "#4d9221"
5674 | ],
5675 | [
5676 | 1,
5677 | "#276419"
5678 | ]
5679 | ],
5680 | "sequential": [
5681 | [
5682 | 0,
5683 | "#0d0887"
5684 | ],
5685 | [
5686 | 0.1111111111111111,
5687 | "#46039f"
5688 | ],
5689 | [
5690 | 0.2222222222222222,
5691 | "#7201a8"
5692 | ],
5693 | [
5694 | 0.3333333333333333,
5695 | "#9c179e"
5696 | ],
5697 | [
5698 | 0.4444444444444444,
5699 | "#bd3786"
5700 | ],
5701 | [
5702 | 0.5555555555555556,
5703 | "#d8576b"
5704 | ],
5705 | [
5706 | 0.6666666666666666,
5707 | "#ed7953"
5708 | ],
5709 | [
5710 | 0.7777777777777778,
5711 | "#fb9f3a"
5712 | ],
5713 | [
5714 | 0.8888888888888888,
5715 | "#fdca26"
5716 | ],
5717 | [
5718 | 1,
5719 | "#f0f921"
5720 | ]
5721 | ],
5722 | "sequentialminus": [
5723 | [
5724 | 0,
5725 | "#0d0887"
5726 | ],
5727 | [
5728 | 0.1111111111111111,
5729 | "#46039f"
5730 | ],
5731 | [
5732 | 0.2222222222222222,
5733 | "#7201a8"
5734 | ],
5735 | [
5736 | 0.3333333333333333,
5737 | "#9c179e"
5738 | ],
5739 | [
5740 | 0.4444444444444444,
5741 | "#bd3786"
5742 | ],
5743 | [
5744 | 0.5555555555555556,
5745 | "#d8576b"
5746 | ],
5747 | [
5748 | 0.6666666666666666,
5749 | "#ed7953"
5750 | ],
5751 | [
5752 | 0.7777777777777778,
5753 | "#fb9f3a"
5754 | ],
5755 | [
5756 | 0.8888888888888888,
5757 | "#fdca26"
5758 | ],
5759 | [
5760 | 1,
5761 | "#f0f921"
5762 | ]
5763 | ]
5764 | },
5765 | "colorway": [
5766 | "#636efa",
5767 | "#EF553B",
5768 | "#00cc96",
5769 | "#ab63fa",
5770 | "#FFA15A",
5771 | "#19d3f3",
5772 | "#FF6692",
5773 | "#B6E880",
5774 | "#FF97FF",
5775 | "#FECB52"
5776 | ],
5777 | "font": {
5778 | "color": "#2a3f5f"
5779 | },
5780 | "geo": {
5781 | "bgcolor": "white",
5782 | "lakecolor": "white",
5783 | "landcolor": "white",
5784 | "showlakes": true,
5785 | "showland": true,
5786 | "subunitcolor": "#C8D4E3"
5787 | },
5788 | "hoverlabel": {
5789 | "align": "left"
5790 | },
5791 | "hovermode": "closest",
5792 | "mapbox": {
5793 | "style": "light"
5794 | },
5795 | "paper_bgcolor": "white",
5796 | "plot_bgcolor": "white",
5797 | "polar": {
5798 | "angularaxis": {
5799 | "gridcolor": "#EBF0F8",
5800 | "linecolor": "#EBF0F8",
5801 | "ticks": ""
5802 | },
5803 | "bgcolor": "white",
5804 | "radialaxis": {
5805 | "gridcolor": "#EBF0F8",
5806 | "linecolor": "#EBF0F8",
5807 | "ticks": ""
5808 | }
5809 | },
5810 | "scene": {
5811 | "xaxis": {
5812 | "backgroundcolor": "white",
5813 | "gridcolor": "#DFE8F3",
5814 | "gridwidth": 2,
5815 | "linecolor": "#EBF0F8",
5816 | "showbackground": true,
5817 | "ticks": "",
5818 | "zerolinecolor": "#EBF0F8"
5819 | },
5820 | "yaxis": {
5821 | "backgroundcolor": "white",
5822 | "gridcolor": "#DFE8F3",
5823 | "gridwidth": 2,
5824 | "linecolor": "#EBF0F8",
5825 | "showbackground": true,
5826 | "ticks": "",
5827 | "zerolinecolor": "#EBF0F8"
5828 | },
5829 | "zaxis": {
5830 | "backgroundcolor": "white",
5831 | "gridcolor": "#DFE8F3",
5832 | "gridwidth": 2,
5833 | "linecolor": "#EBF0F8",
5834 | "showbackground": true,
5835 | "ticks": "",
5836 | "zerolinecolor": "#EBF0F8"
5837 | }
5838 | },
5839 | "shapedefaults": {
5840 | "line": {
5841 | "color": "#2a3f5f"
5842 | }
5843 | },
5844 | "ternary": {
5845 | "aaxis": {
5846 | "gridcolor": "#DFE8F3",
5847 | "linecolor": "#A2B1C6",
5848 | "ticks": ""
5849 | },
5850 | "baxis": {
5851 | "gridcolor": "#DFE8F3",
5852 | "linecolor": "#A2B1C6",
5853 | "ticks": ""
5854 | },
5855 | "bgcolor": "white",
5856 | "caxis": {
5857 | "gridcolor": "#DFE8F3",
5858 | "linecolor": "#A2B1C6",
5859 | "ticks": ""
5860 | }
5861 | },
5862 | "title": {
5863 | "x": 0.05
5864 | },
5865 | "xaxis": {
5866 | "automargin": true,
5867 | "gridcolor": "#EBF0F8",
5868 | "linecolor": "#EBF0F8",
5869 | "ticks": "",
5870 | "title": {
5871 | "standoff": 15
5872 | },
5873 | "zerolinecolor": "#EBF0F8",
5874 | "zerolinewidth": 2
5875 | },
5876 | "yaxis": {
5877 | "automargin": true,
5878 | "gridcolor": "#EBF0F8",
5879 | "linecolor": "#EBF0F8",
5880 | "ticks": "",
5881 | "title": {
5882 | "standoff": 15
5883 | },
5884 | "zerolinecolor": "#EBF0F8",
5885 | "zerolinewidth": 2
5886 | }
5887 | }
5888 | },
5889 | "title": {
5890 | "text": "Monthly Release Patterns and Viewership Hours (2023)"
5891 | },
5892 | "width": 1000,
5893 | "xaxis": {
5894 | "tickmode": "array",
5895 | "ticktext": [
5896 | "Jan",
5897 | "Feb",
5898 | "Mar",
5899 | "Apr",
5900 | "May",
5901 | "Jun",
5902 | "Jul",
5903 | "Aug",
5904 | "Sep",
5905 | "Oct",
5906 | "Nov",
5907 | "Dec"
5908 | ],
5909 | "tickvals": [
5910 | 1,
5911 | 2,
5912 | 3,
5913 | 4,
5914 | 5,
5915 | 6,
5916 | 7,
5917 | 8,
5918 | 9,
5919 | 10,
5920 | 11,
5921 | 12
5922 | ],
5923 | "title": {
5924 | "text": "Month"
5925 | }
5926 | },
5927 | "yaxis": {
5928 | "showgrid": false,
5929 | "side": "left",
5930 | "title": {
5931 | "text": "Number of Releases"
5932 | }
5933 | },
5934 | "yaxis2": {
5935 | "overlaying": "y",
5936 | "showgrid": false,
5937 | "side": "right",
5938 | "title": {
5939 | "text": "Total Hours Viewed (in billions)"
5940 | }
5941 | }
5942 | }
5943 | }
5944 | },
5945 | "metadata": {},
5946 | "output_type": "display_data"
5947 | }
5948 | ],
5949 | "source": [
5950 | "# analyze the number of content releases and their viewership hours across months\n",
5951 | "\n",
5952 | "monthly_releases = netflix_data['Release Month'].value_counts().sort_index()\n",
5953 | "\n",
5954 | "monthly_viewership = netflix_data.groupby('Release Month')['Hours Viewed'].sum()\n",
5955 | "\n",
5956 | "fig = go.Figure()\n",
5957 | "\n",
5958 | "fig.add_trace(\n",
5959 | " go.Bar(\n",
5960 | " x=monthly_releases.index,\n",
5961 | " y=monthly_releases.values,\n",
5962 | " name='Number of Releases',\n",
5963 | " marker_color='goldenrod', \n",
5964 | " opacity=0.7,\n",
5965 | " yaxis='y1'\n",
5966 | " )\n",
5967 | ")\n",
5968 | "\n",
5969 | "fig.add_trace(\n",
5970 | " go.Scatter(\n",
5971 | " x=monthly_viewership.index,\n",
5972 | " y=monthly_viewership.values,\n",
5973 | " name='Viewership Hours',\n",
5974 | " mode='lines+markers',\n",
5975 | " marker=dict(color='red'),\n",
5976 | " line=dict(color='red'),\n",
5977 | " yaxis='y2'\n",
5978 | " )\n",
5979 | ")\n",
5980 | "\n",
5981 | "fig.update_layout(\n",
5982 | " title='Monthly Release Patterns and Viewership Hours (2023)',\n",
5983 | " xaxis=dict(\n",
5984 | " title='Month',\n",
5985 | " tickmode='array',\n",
5986 | " tickvals=list(range(1, 13)),\n",
5987 | " ticktext=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']\n",
5988 | " ),\n",
5989 | " yaxis=dict(\n",
5990 | " title='Number of Releases',\n",
5991 | " showgrid=False,\n",
5992 | " side='left'\n",
5993 | " ),\n",
5994 | " yaxis2=dict(\n",
5995 | " title='Total Hours Viewed (in billions)',\n",
5996 | " overlaying='y',\n",
5997 | " side='right',\n",
5998 | " showgrid=False\n",
5999 | " ),\n",
6000 | " legend=dict(\n",
6001 | " x=1.05, \n",
6002 | " y=1,\n",
6003 | " orientation='v',\n",
6004 | " xanchor='left'\n",
6005 | " ),\n",
6006 | " height=600,\n",
6007 | " width=1000\n",
6008 | ")\n",
6009 | "\n",
6010 | "fig.show()"
6011 | ]
6012 | },
6013 | {
6014 | "cell_type": "code",
6015 | "execution_count": 11,
6016 | "id": "382bf171",
6017 | "metadata": {},
6018 | "outputs": [
6019 | {
6020 | "data": {
6021 | "application/vnd.plotly.v1+json": {
6022 | "config": {
6023 | "plotlyServerURL": "https://plot.ly"
6024 | },
6025 | "data": [
6026 | {
6027 | "marker": {
6028 | "color": "blue"
6029 | },
6030 | "name": "Number of Releases",
6031 | "opacity": 0.6,
6032 | "type": "bar",
6033 | "x": [
6034 | "Monday",
6035 | "Tuesday",
6036 | "Wednesday",
6037 | "Thursday",
6038 | "Friday",
6039 | "Saturday",
6040 | "Sunday"
6041 | ],
6042 | "y": [
6043 | 436,
6044 | 995,
6045 | 1310,
6046 | 1145,
6047 | 3863,
6048 | 238,
6049 | 179
6050 | ],
6051 | "yaxis": "y"
6052 | },
6053 | {
6054 | "line": {
6055 | "color": "red"
6056 | },
6057 | "marker": {
6058 | "color": "red"
6059 | },
6060 | "mode": "lines+markers",
6061 | "name": "Viewership Hours",
6062 | "type": "scatter",
6063 | "x": [
6064 | "Monday",
6065 | "Tuesday",
6066 | "Wednesday",
6067 | "Thursday",
6068 | "Friday",
6069 | "Saturday",
6070 | "Sunday"
6071 | ],
6072 | "y": [
6073 | 3954500000,
6074 | 5562300000,
6075 | 15744100000,
6076 | 20292800000,
6077 | 38217200000,
6078 | 5121800000,
6079 | 1935300000
6080 | ],
6081 | "yaxis": "y2"
6082 | }
6083 | ],
6084 | "layout": {
6085 | "height": 600,
6086 | "legend": {
6087 | "orientation": "v",
6088 | "x": 1.05,
6089 | "xanchor": "left",
6090 | "y": 1
6091 | },
6092 | "template": {
6093 | "data": {
6094 | "bar": [
6095 | {
6096 | "error_x": {
6097 | "color": "#2a3f5f"
6098 | },
6099 | "error_y": {
6100 | "color": "#2a3f5f"
6101 | },
6102 | "marker": {
6103 | "line": {
6104 | "color": "white",
6105 | "width": 0.5
6106 | },
6107 | "pattern": {
6108 | "fillmode": "overlay",
6109 | "size": 10,
6110 | "solidity": 0.2
6111 | }
6112 | },
6113 | "type": "bar"
6114 | }
6115 | ],
6116 | "barpolar": [
6117 | {
6118 | "marker": {
6119 | "line": {
6120 | "color": "white",
6121 | "width": 0.5
6122 | },
6123 | "pattern": {
6124 | "fillmode": "overlay",
6125 | "size": 10,
6126 | "solidity": 0.2
6127 | }
6128 | },
6129 | "type": "barpolar"
6130 | }
6131 | ],
6132 | "carpet": [
6133 | {
6134 | "aaxis": {
6135 | "endlinecolor": "#2a3f5f",
6136 | "gridcolor": "#C8D4E3",
6137 | "linecolor": "#C8D4E3",
6138 | "minorgridcolor": "#C8D4E3",
6139 | "startlinecolor": "#2a3f5f"
6140 | },
6141 | "baxis": {
6142 | "endlinecolor": "#2a3f5f",
6143 | "gridcolor": "#C8D4E3",
6144 | "linecolor": "#C8D4E3",
6145 | "minorgridcolor": "#C8D4E3",
6146 | "startlinecolor": "#2a3f5f"
6147 | },
6148 | "type": "carpet"
6149 | }
6150 | ],
6151 | "choropleth": [
6152 | {
6153 | "colorbar": {
6154 | "outlinewidth": 0,
6155 | "ticks": ""
6156 | },
6157 | "type": "choropleth"
6158 | }
6159 | ],
6160 | "contour": [
6161 | {
6162 | "colorbar": {
6163 | "outlinewidth": 0,
6164 | "ticks": ""
6165 | },
6166 | "colorscale": [
6167 | [
6168 | 0,
6169 | "#0d0887"
6170 | ],
6171 | [
6172 | 0.1111111111111111,
6173 | "#46039f"
6174 | ],
6175 | [
6176 | 0.2222222222222222,
6177 | "#7201a8"
6178 | ],
6179 | [
6180 | 0.3333333333333333,
6181 | "#9c179e"
6182 | ],
6183 | [
6184 | 0.4444444444444444,
6185 | "#bd3786"
6186 | ],
6187 | [
6188 | 0.5555555555555556,
6189 | "#d8576b"
6190 | ],
6191 | [
6192 | 0.6666666666666666,
6193 | "#ed7953"
6194 | ],
6195 | [
6196 | 0.7777777777777778,
6197 | "#fb9f3a"
6198 | ],
6199 | [
6200 | 0.8888888888888888,
6201 | "#fdca26"
6202 | ],
6203 | [
6204 | 1,
6205 | "#f0f921"
6206 | ]
6207 | ],
6208 | "type": "contour"
6209 | }
6210 | ],
6211 | "contourcarpet": [
6212 | {
6213 | "colorbar": {
6214 | "outlinewidth": 0,
6215 | "ticks": ""
6216 | },
6217 | "type": "contourcarpet"
6218 | }
6219 | ],
6220 | "heatmap": [
6221 | {
6222 | "colorbar": {
6223 | "outlinewidth": 0,
6224 | "ticks": ""
6225 | },
6226 | "colorscale": [
6227 | [
6228 | 0,
6229 | "#0d0887"
6230 | ],
6231 | [
6232 | 0.1111111111111111,
6233 | "#46039f"
6234 | ],
6235 | [
6236 | 0.2222222222222222,
6237 | "#7201a8"
6238 | ],
6239 | [
6240 | 0.3333333333333333,
6241 | "#9c179e"
6242 | ],
6243 | [
6244 | 0.4444444444444444,
6245 | "#bd3786"
6246 | ],
6247 | [
6248 | 0.5555555555555556,
6249 | "#d8576b"
6250 | ],
6251 | [
6252 | 0.6666666666666666,
6253 | "#ed7953"
6254 | ],
6255 | [
6256 | 0.7777777777777778,
6257 | "#fb9f3a"
6258 | ],
6259 | [
6260 | 0.8888888888888888,
6261 | "#fdca26"
6262 | ],
6263 | [
6264 | 1,
6265 | "#f0f921"
6266 | ]
6267 | ],
6268 | "type": "heatmap"
6269 | }
6270 | ],
6271 | "heatmapgl": [
6272 | {
6273 | "colorbar": {
6274 | "outlinewidth": 0,
6275 | "ticks": ""
6276 | },
6277 | "colorscale": [
6278 | [
6279 | 0,
6280 | "#0d0887"
6281 | ],
6282 | [
6283 | 0.1111111111111111,
6284 | "#46039f"
6285 | ],
6286 | [
6287 | 0.2222222222222222,
6288 | "#7201a8"
6289 | ],
6290 | [
6291 | 0.3333333333333333,
6292 | "#9c179e"
6293 | ],
6294 | [
6295 | 0.4444444444444444,
6296 | "#bd3786"
6297 | ],
6298 | [
6299 | 0.5555555555555556,
6300 | "#d8576b"
6301 | ],
6302 | [
6303 | 0.6666666666666666,
6304 | "#ed7953"
6305 | ],
6306 | [
6307 | 0.7777777777777778,
6308 | "#fb9f3a"
6309 | ],
6310 | [
6311 | 0.8888888888888888,
6312 | "#fdca26"
6313 | ],
6314 | [
6315 | 1,
6316 | "#f0f921"
6317 | ]
6318 | ],
6319 | "type": "heatmapgl"
6320 | }
6321 | ],
6322 | "histogram": [
6323 | {
6324 | "marker": {
6325 | "pattern": {
6326 | "fillmode": "overlay",
6327 | "size": 10,
6328 | "solidity": 0.2
6329 | }
6330 | },
6331 | "type": "histogram"
6332 | }
6333 | ],
6334 | "histogram2d": [
6335 | {
6336 | "colorbar": {
6337 | "outlinewidth": 0,
6338 | "ticks": ""
6339 | },
6340 | "colorscale": [
6341 | [
6342 | 0,
6343 | "#0d0887"
6344 | ],
6345 | [
6346 | 0.1111111111111111,
6347 | "#46039f"
6348 | ],
6349 | [
6350 | 0.2222222222222222,
6351 | "#7201a8"
6352 | ],
6353 | [
6354 | 0.3333333333333333,
6355 | "#9c179e"
6356 | ],
6357 | [
6358 | 0.4444444444444444,
6359 | "#bd3786"
6360 | ],
6361 | [
6362 | 0.5555555555555556,
6363 | "#d8576b"
6364 | ],
6365 | [
6366 | 0.6666666666666666,
6367 | "#ed7953"
6368 | ],
6369 | [
6370 | 0.7777777777777778,
6371 | "#fb9f3a"
6372 | ],
6373 | [
6374 | 0.8888888888888888,
6375 | "#fdca26"
6376 | ],
6377 | [
6378 | 1,
6379 | "#f0f921"
6380 | ]
6381 | ],
6382 | "type": "histogram2d"
6383 | }
6384 | ],
6385 | "histogram2dcontour": [
6386 | {
6387 | "colorbar": {
6388 | "outlinewidth": 0,
6389 | "ticks": ""
6390 | },
6391 | "colorscale": [
6392 | [
6393 | 0,
6394 | "#0d0887"
6395 | ],
6396 | [
6397 | 0.1111111111111111,
6398 | "#46039f"
6399 | ],
6400 | [
6401 | 0.2222222222222222,
6402 | "#7201a8"
6403 | ],
6404 | [
6405 | 0.3333333333333333,
6406 | "#9c179e"
6407 | ],
6408 | [
6409 | 0.4444444444444444,
6410 | "#bd3786"
6411 | ],
6412 | [
6413 | 0.5555555555555556,
6414 | "#d8576b"
6415 | ],
6416 | [
6417 | 0.6666666666666666,
6418 | "#ed7953"
6419 | ],
6420 | [
6421 | 0.7777777777777778,
6422 | "#fb9f3a"
6423 | ],
6424 | [
6425 | 0.8888888888888888,
6426 | "#fdca26"
6427 | ],
6428 | [
6429 | 1,
6430 | "#f0f921"
6431 | ]
6432 | ],
6433 | "type": "histogram2dcontour"
6434 | }
6435 | ],
6436 | "mesh3d": [
6437 | {
6438 | "colorbar": {
6439 | "outlinewidth": 0,
6440 | "ticks": ""
6441 | },
6442 | "type": "mesh3d"
6443 | }
6444 | ],
6445 | "parcoords": [
6446 | {
6447 | "line": {
6448 | "colorbar": {
6449 | "outlinewidth": 0,
6450 | "ticks": ""
6451 | }
6452 | },
6453 | "type": "parcoords"
6454 | }
6455 | ],
6456 | "pie": [
6457 | {
6458 | "automargin": true,
6459 | "type": "pie"
6460 | }
6461 | ],
6462 | "scatter": [
6463 | {
6464 | "fillpattern": {
6465 | "fillmode": "overlay",
6466 | "size": 10,
6467 | "solidity": 0.2
6468 | },
6469 | "type": "scatter"
6470 | }
6471 | ],
6472 | "scatter3d": [
6473 | {
6474 | "line": {
6475 | "colorbar": {
6476 | "outlinewidth": 0,
6477 | "ticks": ""
6478 | }
6479 | },
6480 | "marker": {
6481 | "colorbar": {
6482 | "outlinewidth": 0,
6483 | "ticks": ""
6484 | }
6485 | },
6486 | "type": "scatter3d"
6487 | }
6488 | ],
6489 | "scattercarpet": [
6490 | {
6491 | "marker": {
6492 | "colorbar": {
6493 | "outlinewidth": 0,
6494 | "ticks": ""
6495 | }
6496 | },
6497 | "type": "scattercarpet"
6498 | }
6499 | ],
6500 | "scattergeo": [
6501 | {
6502 | "marker": {
6503 | "colorbar": {
6504 | "outlinewidth": 0,
6505 | "ticks": ""
6506 | }
6507 | },
6508 | "type": "scattergeo"
6509 | }
6510 | ],
6511 | "scattergl": [
6512 | {
6513 | "marker": {
6514 | "colorbar": {
6515 | "outlinewidth": 0,
6516 | "ticks": ""
6517 | }
6518 | },
6519 | "type": "scattergl"
6520 | }
6521 | ],
6522 | "scattermapbox": [
6523 | {
6524 | "marker": {
6525 | "colorbar": {
6526 | "outlinewidth": 0,
6527 | "ticks": ""
6528 | }
6529 | },
6530 | "type": "scattermapbox"
6531 | }
6532 | ],
6533 | "scatterpolar": [
6534 | {
6535 | "marker": {
6536 | "colorbar": {
6537 | "outlinewidth": 0,
6538 | "ticks": ""
6539 | }
6540 | },
6541 | "type": "scatterpolar"
6542 | }
6543 | ],
6544 | "scatterpolargl": [
6545 | {
6546 | "marker": {
6547 | "colorbar": {
6548 | "outlinewidth": 0,
6549 | "ticks": ""
6550 | }
6551 | },
6552 | "type": "scatterpolargl"
6553 | }
6554 | ],
6555 | "scatterternary": [
6556 | {
6557 | "marker": {
6558 | "colorbar": {
6559 | "outlinewidth": 0,
6560 | "ticks": ""
6561 | }
6562 | },
6563 | "type": "scatterternary"
6564 | }
6565 | ],
6566 | "surface": [
6567 | {
6568 | "colorbar": {
6569 | "outlinewidth": 0,
6570 | "ticks": ""
6571 | },
6572 | "colorscale": [
6573 | [
6574 | 0,
6575 | "#0d0887"
6576 | ],
6577 | [
6578 | 0.1111111111111111,
6579 | "#46039f"
6580 | ],
6581 | [
6582 | 0.2222222222222222,
6583 | "#7201a8"
6584 | ],
6585 | [
6586 | 0.3333333333333333,
6587 | "#9c179e"
6588 | ],
6589 | [
6590 | 0.4444444444444444,
6591 | "#bd3786"
6592 | ],
6593 | [
6594 | 0.5555555555555556,
6595 | "#d8576b"
6596 | ],
6597 | [
6598 | 0.6666666666666666,
6599 | "#ed7953"
6600 | ],
6601 | [
6602 | 0.7777777777777778,
6603 | "#fb9f3a"
6604 | ],
6605 | [
6606 | 0.8888888888888888,
6607 | "#fdca26"
6608 | ],
6609 | [
6610 | 1,
6611 | "#f0f921"
6612 | ]
6613 | ],
6614 | "type": "surface"
6615 | }
6616 | ],
6617 | "table": [
6618 | {
6619 | "cells": {
6620 | "fill": {
6621 | "color": "#EBF0F8"
6622 | },
6623 | "line": {
6624 | "color": "white"
6625 | }
6626 | },
6627 | "header": {
6628 | "fill": {
6629 | "color": "#C8D4E3"
6630 | },
6631 | "line": {
6632 | "color": "white"
6633 | }
6634 | },
6635 | "type": "table"
6636 | }
6637 | ]
6638 | },
6639 | "layout": {
6640 | "annotationdefaults": {
6641 | "arrowcolor": "#2a3f5f",
6642 | "arrowhead": 0,
6643 | "arrowwidth": 1
6644 | },
6645 | "autotypenumbers": "strict",
6646 | "coloraxis": {
6647 | "colorbar": {
6648 | "outlinewidth": 0,
6649 | "ticks": ""
6650 | }
6651 | },
6652 | "colorscale": {
6653 | "diverging": [
6654 | [
6655 | 0,
6656 | "#8e0152"
6657 | ],
6658 | [
6659 | 0.1,
6660 | "#c51b7d"
6661 | ],
6662 | [
6663 | 0.2,
6664 | "#de77ae"
6665 | ],
6666 | [
6667 | 0.3,
6668 | "#f1b6da"
6669 | ],
6670 | [
6671 | 0.4,
6672 | "#fde0ef"
6673 | ],
6674 | [
6675 | 0.5,
6676 | "#f7f7f7"
6677 | ],
6678 | [
6679 | 0.6,
6680 | "#e6f5d0"
6681 | ],
6682 | [
6683 | 0.7,
6684 | "#b8e186"
6685 | ],
6686 | [
6687 | 0.8,
6688 | "#7fbc41"
6689 | ],
6690 | [
6691 | 0.9,
6692 | "#4d9221"
6693 | ],
6694 | [
6695 | 1,
6696 | "#276419"
6697 | ]
6698 | ],
6699 | "sequential": [
6700 | [
6701 | 0,
6702 | "#0d0887"
6703 | ],
6704 | [
6705 | 0.1111111111111111,
6706 | "#46039f"
6707 | ],
6708 | [
6709 | 0.2222222222222222,
6710 | "#7201a8"
6711 | ],
6712 | [
6713 | 0.3333333333333333,
6714 | "#9c179e"
6715 | ],
6716 | [
6717 | 0.4444444444444444,
6718 | "#bd3786"
6719 | ],
6720 | [
6721 | 0.5555555555555556,
6722 | "#d8576b"
6723 | ],
6724 | [
6725 | 0.6666666666666666,
6726 | "#ed7953"
6727 | ],
6728 | [
6729 | 0.7777777777777778,
6730 | "#fb9f3a"
6731 | ],
6732 | [
6733 | 0.8888888888888888,
6734 | "#fdca26"
6735 | ],
6736 | [
6737 | 1,
6738 | "#f0f921"
6739 | ]
6740 | ],
6741 | "sequentialminus": [
6742 | [
6743 | 0,
6744 | "#0d0887"
6745 | ],
6746 | [
6747 | 0.1111111111111111,
6748 | "#46039f"
6749 | ],
6750 | [
6751 | 0.2222222222222222,
6752 | "#7201a8"
6753 | ],
6754 | [
6755 | 0.3333333333333333,
6756 | "#9c179e"
6757 | ],
6758 | [
6759 | 0.4444444444444444,
6760 | "#bd3786"
6761 | ],
6762 | [
6763 | 0.5555555555555556,
6764 | "#d8576b"
6765 | ],
6766 | [
6767 | 0.6666666666666666,
6768 | "#ed7953"
6769 | ],
6770 | [
6771 | 0.7777777777777778,
6772 | "#fb9f3a"
6773 | ],
6774 | [
6775 | 0.8888888888888888,
6776 | "#fdca26"
6777 | ],
6778 | [
6779 | 1,
6780 | "#f0f921"
6781 | ]
6782 | ]
6783 | },
6784 | "colorway": [
6785 | "#636efa",
6786 | "#EF553B",
6787 | "#00cc96",
6788 | "#ab63fa",
6789 | "#FFA15A",
6790 | "#19d3f3",
6791 | "#FF6692",
6792 | "#B6E880",
6793 | "#FF97FF",
6794 | "#FECB52"
6795 | ],
6796 | "font": {
6797 | "color": "#2a3f5f"
6798 | },
6799 | "geo": {
6800 | "bgcolor": "white",
6801 | "lakecolor": "white",
6802 | "landcolor": "white",
6803 | "showlakes": true,
6804 | "showland": true,
6805 | "subunitcolor": "#C8D4E3"
6806 | },
6807 | "hoverlabel": {
6808 | "align": "left"
6809 | },
6810 | "hovermode": "closest",
6811 | "mapbox": {
6812 | "style": "light"
6813 | },
6814 | "paper_bgcolor": "white",
6815 | "plot_bgcolor": "white",
6816 | "polar": {
6817 | "angularaxis": {
6818 | "gridcolor": "#EBF0F8",
6819 | "linecolor": "#EBF0F8",
6820 | "ticks": ""
6821 | },
6822 | "bgcolor": "white",
6823 | "radialaxis": {
6824 | "gridcolor": "#EBF0F8",
6825 | "linecolor": "#EBF0F8",
6826 | "ticks": ""
6827 | }
6828 | },
6829 | "scene": {
6830 | "xaxis": {
6831 | "backgroundcolor": "white",
6832 | "gridcolor": "#DFE8F3",
6833 | "gridwidth": 2,
6834 | "linecolor": "#EBF0F8",
6835 | "showbackground": true,
6836 | "ticks": "",
6837 | "zerolinecolor": "#EBF0F8"
6838 | },
6839 | "yaxis": {
6840 | "backgroundcolor": "white",
6841 | "gridcolor": "#DFE8F3",
6842 | "gridwidth": 2,
6843 | "linecolor": "#EBF0F8",
6844 | "showbackground": true,
6845 | "ticks": "",
6846 | "zerolinecolor": "#EBF0F8"
6847 | },
6848 | "zaxis": {
6849 | "backgroundcolor": "white",
6850 | "gridcolor": "#DFE8F3",
6851 | "gridwidth": 2,
6852 | "linecolor": "#EBF0F8",
6853 | "showbackground": true,
6854 | "ticks": "",
6855 | "zerolinecolor": "#EBF0F8"
6856 | }
6857 | },
6858 | "shapedefaults": {
6859 | "line": {
6860 | "color": "#2a3f5f"
6861 | }
6862 | },
6863 | "ternary": {
6864 | "aaxis": {
6865 | "gridcolor": "#DFE8F3",
6866 | "linecolor": "#A2B1C6",
6867 | "ticks": ""
6868 | },
6869 | "baxis": {
6870 | "gridcolor": "#DFE8F3",
6871 | "linecolor": "#A2B1C6",
6872 | "ticks": ""
6873 | },
6874 | "bgcolor": "white",
6875 | "caxis": {
6876 | "gridcolor": "#DFE8F3",
6877 | "linecolor": "#A2B1C6",
6878 | "ticks": ""
6879 | }
6880 | },
6881 | "title": {
6882 | "x": 0.05
6883 | },
6884 | "xaxis": {
6885 | "automargin": true,
6886 | "gridcolor": "#EBF0F8",
6887 | "linecolor": "#EBF0F8",
6888 | "ticks": "",
6889 | "title": {
6890 | "standoff": 15
6891 | },
6892 | "zerolinecolor": "#EBF0F8",
6893 | "zerolinewidth": 2
6894 | },
6895 | "yaxis": {
6896 | "automargin": true,
6897 | "gridcolor": "#EBF0F8",
6898 | "linecolor": "#EBF0F8",
6899 | "ticks": "",
6900 | "title": {
6901 | "standoff": 15
6902 | },
6903 | "zerolinecolor": "#EBF0F8",
6904 | "zerolinewidth": 2
6905 | }
6906 | }
6907 | },
6908 | "title": {
6909 | "text": "Weekly Release Patterns and Viewership Hours (2023)"
6910 | },
6911 | "width": 1000,
6912 | "xaxis": {
6913 | "categoryarray": [
6914 | "Monday",
6915 | "Tuesday",
6916 | "Wednesday",
6917 | "Thursday",
6918 | "Friday",
6919 | "Saturday",
6920 | "Sunday"
6921 | ],
6922 | "categoryorder": "array",
6923 | "title": {
6924 | "text": "Day of the Week"
6925 | }
6926 | },
6927 | "yaxis": {
6928 | "showgrid": false,
6929 | "side": "left",
6930 | "title": {
6931 | "text": "Number of Releases"
6932 | }
6933 | },
6934 | "yaxis2": {
6935 | "overlaying": "y",
6936 | "showgrid": false,
6937 | "side": "right",
6938 | "title": {
6939 | "text": "Total Hours Viewed (in billions)"
6940 | }
6941 | }
6942 | }
6943 | }
6944 | },
6945 | "metadata": {},
6946 | "output_type": "display_data"
6947 | }
6948 | ],
6949 | "source": [
6950 | "netflix_data['Release Day'] = netflix_data['Release Date'].dt.day_name()\n",
6951 | "\n",
6952 | "weekday_releases = netflix_data['Release Day'].value_counts().reindex(\n",
6953 | " ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\n",
6954 | ")\n",
6955 | "\n",
6956 | "# aggregate viewership hours by day of the week\n",
6957 | "weekday_viewership = netflix_data.groupby('Release Day')['Hours Viewed'].sum().reindex(\n",
6958 | " ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\n",
6959 | ")\n",
6960 | "\n",
6961 | "fig = go.Figure()\n",
6962 | "\n",
6963 | "fig.add_trace(\n",
6964 | " go.Bar(\n",
6965 | " x=weekday_releases.index,\n",
6966 | " y=weekday_releases.values,\n",
6967 | " name='Number of Releases',\n",
6968 | " marker_color='blue',\n",
6969 | " opacity=0.6,\n",
6970 | " yaxis='y1'\n",
6971 | " )\n",
6972 | ")\n",
6973 | "\n",
6974 | "fig.add_trace(\n",
6975 | " go.Scatter(\n",
6976 | " x=weekday_viewership.index,\n",
6977 | " y=weekday_viewership.values,\n",
6978 | " name='Viewership Hours',\n",
6979 | " mode='lines+markers',\n",
6980 | " marker=dict(color='red'),\n",
6981 | " line=dict(color='red'),\n",
6982 | " yaxis='y2'\n",
6983 | " )\n",
6984 | ")\n",
6985 | "\n",
6986 | "fig.update_layout(\n",
6987 | " title='Weekly Release Patterns and Viewership Hours (2023)',\n",
6988 | " xaxis=dict(\n",
6989 | " title='Day of the Week',\n",
6990 | " categoryorder='array',\n",
6991 | " categoryarray=['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']\n",
6992 | " ),\n",
6993 | " yaxis=dict(\n",
6994 | " title='Number of Releases',\n",
6995 | " showgrid=False,\n",
6996 | " side='left'\n",
6997 | " ),\n",
6998 | " yaxis2=dict(\n",
6999 | " title='Total Hours Viewed (in billions)',\n",
7000 | " overlaying='y',\n",
7001 | " side='right',\n",
7002 | " showgrid=False\n",
7003 | " ),\n",
7004 | " legend=dict(\n",
7005 | " x=1.05, \n",
7006 | " y=1,\n",
7007 | " orientation='v',\n",
7008 | " xanchor='left'\n",
7009 | " ),\n",
7010 | " height=600,\n",
7011 | " width=1000\n",
7012 | ")\n",
7013 | "\n",
7014 | "fig.show()"
7015 | ]
7016 | },
7017 | {
7018 | "cell_type": "code",
7019 | "execution_count": 12,
7020 | "id": "5ba82cc3",
7021 | "metadata": {},
7022 | "outputs": [
7023 | {
7024 | "data": {
7025 | "text/html": [
7026 | "\n",
7027 | "\n",
7040 | "
\n",
7041 | " \n",
7042 | " \n",
7043 | " | \n",
7044 | " Title | \n",
7045 | " Release Date | \n",
7046 | " Hours Viewed | \n",
7047 | "
\n",
7048 | " \n",
7049 | " \n",
7050 | " \n",
7051 | " | 2 | \n",
7052 | " The Glory: Season 1 // 더 글로리: 시즌 1 | \n",
7053 | " 2022-12-30 | \n",
7054 | " 622800000.0 | \n",
7055 | "
\n",
7056 | " \n",
7057 | " | 6 | \n",
7058 | " La Reina del Sur: Season 3 | \n",
7059 | " 2022-12-30 | \n",
7060 | " 429600000.0 | \n",
7061 | "
\n",
7062 | " \n",
7063 | " | 11 | \n",
7064 | " Kaleidoscope: Limited Series | \n",
7065 | " 2023-01-01 | \n",
7066 | " 252500000.0 | \n",
7067 | "
\n",
7068 | " \n",
7069 | " | 29 | \n",
7070 | " Perfect Match: Season 1 | \n",
7071 | " 2023-02-14 | \n",
7072 | " 176800000.0 | \n",
7073 | "
\n",
7074 | " \n",
7075 | " | 124 | \n",
7076 | " Lady Voyeur: Limited Series // Olhar Indiscret... | \n",
7077 | " 2022-12-31 | \n",
7078 | " 86000000.0 | \n",
7079 | "
\n",
7080 | " \n",
7081 | " | ... | \n",
7082 | " ... | \n",
7083 | " ... | \n",
7084 | " ... | \n",
7085 | "
\n",
7086 | " \n",
7087 | " | 22324 | \n",
7088 | " The Romantics: Limited Series | \n",
7089 | " 2023-02-14 | \n",
7090 | " 1000000.0 | \n",
7091 | "
\n",
7092 | " \n",
7093 | " | 22327 | \n",
7094 | " Aggretsuko: Season 5 // アグレッシブ烈子: シーズン5 | \n",
7095 | " 2023-02-16 | \n",
7096 | " 900000.0 | \n",
7097 | "
\n",
7098 | " \n",
7099 | " | 22966 | \n",
7100 | " The Lying Life of Adults: Limited Series // La... | \n",
7101 | " 2023-01-04 | \n",
7102 | " 900000.0 | \n",
7103 | "
\n",
7104 | " \n",
7105 | " | 22985 | \n",
7106 | " Community Squad: Season 1 // División Palermo:... | \n",
7107 | " 2023-02-17 | \n",
7108 | " 800000.0 | \n",
7109 | "
\n",
7110 | " \n",
7111 | " | 24187 | \n",
7112 | " Live to Lead: Limited Series | \n",
7113 | " 2022-12-31 | \n",
7114 | " 400000.0 | \n",
7115 | "
\n",
7116 | " \n",
7117 | "
\n",
7118 | "
98 rows × 3 columns
\n",
7119 | "
"
7120 | ],
7121 | "text/plain": [
7122 | " Title Release Date \\\n",
7123 | "2 The Glory: Season 1 // 더 글로리: 시즌 1 2022-12-30 \n",
7124 | "6 La Reina del Sur: Season 3 2022-12-30 \n",
7125 | "11 Kaleidoscope: Limited Series 2023-01-01 \n",
7126 | "29 Perfect Match: Season 1 2023-02-14 \n",
7127 | "124 Lady Voyeur: Limited Series // Olhar Indiscret... 2022-12-31 \n",
7128 | "... ... ... \n",
7129 | "22324 The Romantics: Limited Series 2023-02-14 \n",
7130 | "22327 Aggretsuko: Season 5 // アグレッシブ烈子: シーズン5 2023-02-16 \n",
7131 | "22966 The Lying Life of Adults: Limited Series // La... 2023-01-04 \n",
7132 | "22985 Community Squad: Season 1 // División Palermo:... 2023-02-17 \n",
7133 | "24187 Live to Lead: Limited Series 2022-12-31 \n",
7134 | "\n",
7135 | " Hours Viewed \n",
7136 | "2 622800000.0 \n",
7137 | "6 429600000.0 \n",
7138 | "11 252500000.0 \n",
7139 | "29 176800000.0 \n",
7140 | "124 86000000.0 \n",
7141 | "... ... \n",
7142 | "22324 1000000.0 \n",
7143 | "22327 900000.0 \n",
7144 | "22966 900000.0 \n",
7145 | "22985 800000.0 \n",
7146 | "24187 400000.0 \n",
7147 | "\n",
7148 | "[98 rows x 3 columns]"
7149 | ]
7150 | },
7151 | "execution_count": 12,
7152 | "metadata": {},
7153 | "output_type": "execute_result"
7154 | }
7155 | ],
7156 | "source": [
7157 | "# define significant holidays and events in 2023\n",
7158 | "important_dates = [\n",
7159 | " '2023-01-01', # new year's day\n",
7160 | " '2023-02-14', # valentine's ay\n",
7161 | " '2023-07-04', # independence day (US)\n",
7162 | " '2023-10-31', # halloween\n",
7163 | " '2023-12-25' # christmas day\n",
7164 | "]\n",
7165 | "\n",
7166 | "# convert to datetime\n",
7167 | "important_dates = pd.to_datetime(important_dates)\n",
7168 | "\n",
7169 | "# check for content releases close to these significant holidays (within a 3-day window)\n",
7170 | "holiday_releases = netflix_data[netflix_data['Release Date'].apply(\n",
7171 | " lambda x: any((x - date).days in range(-3, 4) for date in important_dates)\n",
7172 | ")]\n",
7173 | "\n",
7174 | "# aggregate viewership hours for releases near significant holidays\n",
7175 | "holiday_viewership = holiday_releases.groupby('Release Date')['Hours Viewed'].sum()\n",
7176 | "\n",
7177 | "holiday_releases[['Title', 'Release Date', 'Hours Viewed']]"
7178 | ]
7179 | },
7180 | {
7181 | "cell_type": "code",
7182 | "execution_count": null,
7183 | "id": "370cbcf5",
7184 | "metadata": {},
7185 | "outputs": [],
7186 | "source": []
7187 | }
7188 | ],
7189 | "metadata": {
7190 | "kernelspec": {
7191 | "display_name": "base",
7192 | "language": "python",
7193 | "name": "python3"
7194 | },
7195 | "language_info": {
7196 | "codemirror_mode": {
7197 | "name": "ipython",
7198 | "version": 3
7199 | },
7200 | "file_extension": ".py",
7201 | "mimetype": "text/x-python",
7202 | "name": "python",
7203 | "nbconvert_exporter": "python",
7204 | "pygments_lexer": "ipython3",
7205 | "version": "3.11.7"
7206 | }
7207 | },
7208 | "nbformat": 4,
7209 | "nbformat_minor": 5
7210 | }
7211 |
--------------------------------------------------------------------------------