Beispiel #1
0
def revenue_budget():
    ''' budget level with high revenue movies'''
    
    budget_data = utils.group_creation(df['budget']);
    df['budget_group'] = pd.cut(df['budget'], budget_data[1], labels=budget_data[0], include_lowest = True)
    mean = df.groupby('budget_group')['revenue'].mean()
    median = df.groupby('budget_group')['revenue'].median()
    
    plt.bar(np.arange(len(mean)),mean, label='mean')
    plt.ylabel('Revenue')
    plt.xlabel('budget groups')
    plt.title('Budget and Revenue relationships')
    plt.xticks(np.arange(len(mean)), median.index)
    plt.show()
    return None
Beispiel #2
0
def popularity_traits_earnings():
    '''Profit/Loss and popularity relationship'''
    
    earning_data = utils.group_creation(df['profit_loss'])
    df['pl_group'] = pd.cut(df['profit_loss'], earning_data[1], labels=earning_data[0], include_lowest = True)
    mean = df.groupby('pl_group')['popularity'].mean()
    median = df.groupby('pl_group')['popularity'].median()
    
    plt.bar(np.arange(len(mean)),mean, label='mean')
    plt.ylabel('popularity')
    plt.xlabel('Profit/Loss groups')
    plt.title('Profit/Loss and Popularity relationships')
    plt.xticks(np.arange(len(mean)), median.index)
    plt.show()
    return None
Beispiel #3
0
def popularity_traits_votes():
    '''Vote average and popularity relationship'''
    
    votes_data = utils.group_creation(df['vote_average']);
    df['va_group'] = pd.cut(df['vote_average'], votes_data[1], labels=votes_data[0], include_lowest = True)
    mean = df.groupby('va_group')['popularity'].mean()
    median = df.groupby('va_group')['popularity'].median()
    
    plt.bar(np.arange(len(mean)),mean, label='mean')
    plt.ylabel('popularity')
    plt.xlabel('Votes groups')
    plt.title('Votes/Loss and Popularity relationships')
    plt.xticks(np.arange(len(mean)), median.index)
    plt.show()
    return None
Beispiel #4
0
def popularity_traits_runtime():
    '''Runtime and popularity relationship'''
    
    runtime_data = utils.group_creation(df['runtime'])
    df['runtime_group'] = pd.cut(df['runtime'], runtime_data[1], labels=runtime_data[0], include_lowest = True)
    mean = df.groupby('runtime_group')['popularity'].mean()
    median = df.groupby('runtime_group')['popularity'].median()
    
    plt.bar(np.arange(len(mean)),mean, label='mean')
    plt.ylabel('popularity')
    plt.xlabel('Runtime groups')
    plt.title('Runtime and Popularity relationships')
    plt.xticks(np.arange(len(mean)), median.index)
    plt.show()
    return None