Пример #1
0
         color='olive', linewidth=1, marker='o', markerfacecolor='yellowgreen', markersize=6)
plt.plot(eff_mac_dmu.loc[eff_mac_dmu['year'] >=2014, 'year'], 
         eff_mac_dmu.loc[eff_mac_dmu['firm_292'] != 0,'firm_292'],
         color='purple', linewidth=1, marker='o', markerfacecolor='violet', markersize=6)
plt.plot(eff_mac_dmu.loc[eff_mac_dmu['year'] >=2013, 'year'], 
         eff_mac_dmu.loc[eff_mac_dmu['firm_381'] != 0,'firm_381'],
         color='darkred', linewidth=1, marker='o', markerfacecolor='red', markersize=6)
plt.plot(eff_mac_dmu.loc[eff_mac_dmu['year'] >=2014, 'year'], 
         eff_mac_dmu.loc[eff_mac_dmu['firm_554'] != 0,'firm_554'],
         color='black', linewidth=1, marker='o', markerfacecolor='silver', markersize=6)
plt.plot(eff_mac_dmu.loc[eff_mac_dmu['year'] >=2014, 'year'], 
         eff_mac_dmu.loc[eff_mac_dmu['firm_1859'] != 0,'firm_1859'],
         color='forestgreen', linewidth=1, marker='o', markerfacecolor='limegreen', markersize=6)
plt.title('Efficient newborn firms in machinery sector', color='blue', fontsize=20)
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)
Пример #2
0
         marker='o',
         markerfacecolor='violet',
         markersize=6)
plt.plot(eff_elec_dmu.loc[eff_elec_dmu['year'] >= 2015, 'year'],
         eff_elec_dmu.loc[eff_elec_dmu['firm_643'].notnull(), 'firm_643'],
         color='darkred',
         linewidth=1,
         marker='o',
         markerfacecolor='red',
         markersize=6)
plt.title('Efficient newborn firms in electronic sector',
          color='blue',
          fontsize=20)
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)
Пример #3
0
title_list = ['eff_score_chem.csv', 'eff_score_elec.csv', 'eff_score_mac.csv']
eff_chem, eff_elec, eff_mac = [
    preda.read_eff_score(title) for title in title_list
]

sales = ['sales_chem.csv', 'sales_elec.csv', 'sales_mac.csv']
sales_chem, sales_elec, sales_mac = [
    pd.read_csv(title, sep='|').iloc[:, 1:] for title in sales
]

eff_chem_dmu = preda.eff_dmu(eff_chem)
eff_elec_dmu = preda.eff_dmu(eff_elec)
eff_mac_dmu = preda.eff_dmu(eff_mac)
"""with geometric average"""
summary_chem = preda.efficiency_sum_stats(eff_chem)
summary_elec = preda.efficiency_sum_stats(eff_elec)
summary_mac = preda.efficiency_sum_stats(eff_mac)
"""with weighted average"""
summary_chem = preda.efficiency_sum_stats_weighted(eff_chem, sales_chem)
summary_elec = preda.efficiency_sum_stats_weighted(eff_elec, sales_elec)
summary_mac = preda.efficiency_sum_stats_weighted(eff_mac, sales_mac)

preda.eff_distribution_OT(
    eff_chem,
    summary_chem,
    140,
    36,
    21,
    title=' Efficiency level of chemical sector over time')
preda.eff_distribution_OT(
Пример #4
0
sales_chem = total_chem_edit.loc[:, ['ID', 's_10', 's_11', 's_12', 's_13', 's_14', 's_15',
                                     's_16', 's_17', 's_18']]
sales_chem.loc[sales_chem['ID'] == 335, ['s_12', 's_13']] =np.nan
sales_chem.loc[sales_chem['ID'].isin([151,299]), ['s_13', 's_14']] = np.nan
for i in range(10,19):
    sales_chem.loc[:,f's_{i}'] = sales_chem.loc[:,f's_{i}']/np.nansum(sales_chem.loc[:,f's_{i}'])
sales_chem.to_csv('sales_chem.csv', sep = '|')

# read result

eff_chem = pd.read_csv('efficiency_chemical.csv').drop('Unnamed: 0', axis =1)

eff_chem = pd.read_csv('eff_score_chem.csv').drop('Unnamed: 0', axis =1)

eff_chem.replace(0,np.nan, inplace=True)
summary = preda.efficiency_sum_stats(eff_chem)
summary_by_age = preda.eff_stats_by_age_merged(eff_chem, 140, 36, 21)

preda.eff_distribution_OT(eff_chem, summary)

preda.eff_distribution_OT_by_age(eff_chem, summary)

'''plt.subplots(figsize=(10,8))
sns.boxplot(x='Year', y='Eff_score', data= eff_melt.dropna(), linewidth=.9, color='steelblue')
sns.pointplot(x=eff_melt.iloc[0:9,1], y=summary['Mean'], scale=1, color='k', errwidth=1.5, capsize=0.2, markers='x', linestyles=' ')
sns.pointplot(x=eff_melt.iloc[0:9,1], y=summary['Mean'], scale=0.4, color='k', errwidth=0, capsize=0, linestyles='--')
plt.title('Efficiency level of chemical sector over time', fontsize=20)

plt.subplots(figsize=(10,8))
sns.boxplot(x='Year', y='Eff_score', data= eff_melt.dropna(), hue='Age', palette='GnBu_d')
plt.title('Efficiency level of chemical firms by age over time', fontsize=20)'''