-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprogram.py
33 lines (25 loc) · 1.12 KB
/
program.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import matplotlib.pyplot as plt
import pandas as pd
# Read in the Netflix CSV as a DataFrame
netflixDataframe = pd.read_csv("netflix_data.csv")
# Subset the DataFrame for type "Movie"
netflixSubset = netflixDataframe[netflixDataframe["type"] == "Movie"]
# Filter the data to keep only movies released in the 1990s
movies1990s = netflixSubset[
(netflixSubset["release_year"] >= 1990) & (netflixSubset["release_year"] < 2000)
]
# Visualize the duration column of your filtered data to see the distribution of movie durations
plt.hist(movies1990s["duration"])
plt.title("Distribution of Movie Durations in the 1990s")
plt.xlabel("Duration (in minutes)")
plt.ylabel("Number of movies")
plt.show()
# Filter the data again to keep only the Action movies
actionMovies = movies1990s[movies1990s["genre"] == "Action"]
duration = 100
shortMovies = 0
# Iterate over the labels and rows of the DataFrame and check if the duration is less than 90, if it is, add 1 to the counter, if it isn't, the counter should remain the same
for label, row in actionMovies.iterrows():
if row["duration"] < 90:
shortMovies += 1
print(shortMovies)