#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Mar 15 13:11:42 2018 @author: teacher """ import pandas as pd import matplotlib.pyplot as plt # Read csv file in as a dataframe movies = pd.read_csv("imdb_1000.csv") # Plot histogram of duration of all movies movies['duration'].plot.hist() action_cond = movies['genre'] == 'Action' action_movies = movies[action_cond] crime_movies = movies[movies['genre'] == 'Crime'] action_mean = action_movies['duration'].mean() crime_mean = crime_movies['duration'].mean() print("Mean of duration of action movies",action_mean) print("Mean of duration of crime movies",crime_mean) plt.show() action_movies['duration'].plot.hist(alpha = 0.5, bins=20) crime_movies['duration'].plot.hist(alpha = 0.5, bins = 20)