Comparing the number of opportunites based on artist advance

In [33]:
import pandas as pd
import numpy as np
from plotnine import *
from plotnine import options
options.figure_size = (12, 8)
from dfply import *
import warnings
warnings.filterwarnings('ignore')

streams = pd.read_feather( '../../data/pop_5_release.feather')

def streams_based_on(price, pps = 5e-3, pop_5_slippage = 0.15, artist_adv = 0.8):
    return price/(pps*(1-pop_5_slippage)*artist_adv)

two_limit = streams_based_on(2e3)
min_limit = streams_based_on(5e3)
tenk_lim = streams_based_on(10e3)
twenty_lim = streams_based_on(20e3)
fifty_lim = streams_based_on(50e3)

streams['Artist_Advance'] = pd.cut(streams['streams'], 
                                       bins = [0,two_limit, min_limit, tenk_lim, twenty_lim, fifty_lim, 100e20], 
                                       labels = ['<2k','5k', '10k', '20k', '30k', '>50k'])

actual_stream_counts = streams.groupby('Artist_Advance')['streams'].agg([len, min, np.mean, np.median,max])

actual_stream_counts.columns = ['Number of tracks', 'Min streams', 'Mean streams', 'Median streams', 'Max Streams']
In [34]:
actual_stream_counts
Out[34]:
Number of tracks Min streams Mean streams Median streams Max Streams
Artist_Advance
<2k 1248 10 1.082879e+05 37760.5 581970
5k 171 588900 9.344912e+05 882289.0 1466000
10k 93 1487000 2.117939e+06 2039966.0 2897000
20k 65 2949000 4.042791e+06 3997000.0 5767000
30k 40 6022000 8.885636e+06 8481000.0 14650000
>50k 64 14884400 7.826420e+07 29884500.0 740764000
In [35]:
streams.head()
Out[35]:
track_spyid value spyid release_date first_seen days_since_release streams pop_5_date streams_100_date Artist_Advance
0 3QcFgVYo5UngnkoHtUKQPo 42 3QcFgVYo5UngnkoHtUKQPo 2018-02-27 2018-03-03 08:15:12.814499 5 1065074 2018-03-04 2018-06-06 5k
1 6AOkhCjwfOSDj8uwsgfXxF 8 6AOkhCjwfOSDj8uwsgfXxF 2018-02-26 2018-03-03 03:39:07.475948 5 8365 2018-03-03 2018-06-06 <2k
2 0oMS8S85Ztgj1nzgHs69X5 44 0oMS8S85Ztgj1nzgHs69X5 2018-02-27 2018-03-03 03:39:07.178301 5 1300000 2018-03-04 2018-06-06 5k
3 7CfqRcuy4WTP7928BziSW0 6 7CfqRcuy4WTP7928BziSW0 2018-02-27 2018-03-03 03:39:07.136362 5 27637 2018-03-04 2018-06-06 <2k
4 2NAihRUyr75yyMEuuc0BvP 16 2NAihRUyr75yyMEuuc0BvP 2018-02-26 2018-03-03 03:39:06.879209 5 186000 2018-03-03 2018-06-06 <2k
In [36]:
ggplot(streams, aes('release_date')) + geom_bar(aes(fill='Artist_Advance'))
Out[36]:
<ggplot: (8748242620743)>
In [37]:
ggplot(streams >> mask(X.release_date > '2018-02-01', X.release_date < '2018-03-01'), aes('release_date')) + geom_bar(aes(fill='Artist_Advance'))
Out[37]:
<ggplot: (8748242633792)>