Exemplo n.º 1
0
plt.ylabel('efficiency score', color='blue', fontsize=14)
summary=preda.efficiency_sum_stats(eff_mac)
summary_by_age = preda.eff_stats_by_age_merged(eff_mac, 241, 41, 23)
from time import strftime 
writer = pd.ExcelWriter(strftime('Report_machinery_geo %Y-%m-%d.xlsx'))
eff_mac_dmu.to_excel(writer, 'eff_firms')
summary.to_excel(writer, 'eff_summary_stats')
summary_by_age.to_excel(writer, 'eff_score_by_age')

#malmquist index
# how many firms grow over time? pc>1
df = preda.read_malmquist('malmquist_machinery.csv')

df_mac = preda.read_malmquist('malmquist_tovrs_mac.csv')

df_compare = preda.encode_change(df, 241, 41, 23)
growth_dmu = preda.growth_dmu(df_compare, 307)
efficiency_growth = preda.ec_dmu(df_compare)
source_pc_machinery = preda.source_pc_sector(df, 242, 42, 23)
comparison = preda.comparison(df, 242, 42, 23)
source_pd_sector = preda.source_pd_sector(source_pc_machinery, comparison, 242, 42, 23)
avg_change_total = preda.average_change(df,'total')
avg_change_total.to_excel(writer, 'overall_avg_change')
writer.save()
preda.visualize_change_by_group(avg_change_total, 'total')
df_old = df.iloc[0:242,]
df_young = df.iloc[242:284,]
df_newborn = df.iloc[284:307,]
avg_change_by_age = preda.avg_change_bygroup(df_old, df_young, df_newborn)

preda.visualize_change_by_group(avg_change_by_age, 'newborn')
Exemplo n.º 2
0
plt.ylabel('efficiency score', color='blue', fontsize=14)
#aggregate the result
summary = preda.efficiency_sum_stats(eff_elec)
summary_by_age = preda.eff_stats_by_age_merged(eff_elec, 175, 41, 17)
from time import strftime
writer = pd.ExcelWriter(strftime('Report_electronics_geo %Y-%m-%d.xlsx'))
eff_elec_dmu.to_excel(writer, 'eff_firms')
summary.to_excel(writer, 'eff_summary_stats')
summary_by_age.to_excel(writer, 'eff_score_by_age')

# Malmquist index
df = preda.read_malmquist('malmquist_electronic.csv')

df_elec = preda.read_malmquist('malmquist_tovrs_elec.csv')

df_compare = preda.encode_change(df, 177, 42, 18)
growth_dmu = preda.growth_dmu(df_compare, 237)
efficiency_growth = preda.ec_dmu(df_compare)
# visualization
avg_change_total = preda.average_change(df, 'total')
avg_change_total.to_excel(writer, 'overall_avg_change')
writer.save()
preda.visualize_change_by_group(avg_change_total, 'total')
df_old = df.iloc[0:177, ]
df_young = df.iloc[177:219, ]
df_newborn = df.iloc[219:237, ]
avg_change_by_age = preda.avg_change_bygroup(df_old, df_young, df_newborn)
preda.visualize_change_by_group(avg_change_by_age, 'newborn')
preda.visualize_change_by_group(avg_change_by_age, 'old')
preda.visualize_change_by_group(avg_change_by_age, 'young')
growth_dmu(df_compare)

def ec_dmu(df_compare):
    efficiency_growth = 0
    dmu = []
    for i in range(0, 198):
        if all(df_compare.iloc[i,[2,5,8,11,14,17,20]] ==1):
            efficiency_growth += 1
            dmu.append(i)
    return efficiency_growth, dmu

ec_dmu(df_compare)
            
df_compare.sum()
df_compare = preda.encode_change(df)
growth_dmu(df_compare)
ec_dmu(df_compare)
ec_over_tc_old = 0
for i in range(0,140):
    if df.loc[i,'pc_11'] > 1 and df.loc[i,'ec_11'] > df.loc[i,'tc_11']:
        ec_over_tc_old += 1
ec_over_tc_young = 0
for i in range(140, 176):
    if df.loc[i,'pc_11'] > 1 and df.loc[i,'ec_11'] > df.loc[i,'tc_11']:
        ec_over_tc_young += 1        

ec_over_tc_young

        
Exemplo n.º 4
0
plt.title('Efficient newborn firms in chemical sector', color='blue', fontsize=20)
plt.ylabel('efficiency score', color='blue', fontsize=14)


from time import strftime 
writer = pd.ExcelWriter(strftime('Report_chemicals_geo %Y-%m-%d.xlsx'))
eff_chem_dmu.to_excel(writer, 'eff_firms')
summary.to_excel(writer, 'eff_summary_stats')
summary_by_age.to_excel(writer, 'eff_score_by_age')
writer.save()
# Malmquist index
df = preda.read_malmquist('malmquist_chemical.csv')

df_chem = preda.read_malmquist('malmquist_tovrs_chem.csv')

df_compare = preda.encode_change(df, 140, 36, 22)
growth_dmu = preda.growth_dmu(df_compare, 198)
efficiency_growth = preda.ec_dmu(df_compare)
source_pc_machinery = preda.source_pc_sector(df, 140, 36, 22)
comparison = preda.comparison(df, 140, 36, 22)
source_pd_sector = preda.source_pd_sector(source_pc_machinery, comparison, 140, 36, 22)
avg_change_total = preda.average_change(df,'total')
avg_change_total.to_excel(writer, 'overall_avg_change')
writer.save()
preda.visualize_change_by_group(avg_change_total, 'total')
df_old = df.iloc[0:140,]
df_young = df.iloc[140:176,]
df_newborn = df.iloc[176:198,]
avg_change_by_age = preda.avg_change_bygroup(df_old, df_young, df_newborn)
avg_change_by_age.replace(1,np.nan,inplace=True)
preda.visualize_change_by_group(avg_change_by_age, 'newborn')