IIabm/analysis_prod.py

23 lines
785 B
Python

import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import networkx as nx
import math
plt.rcParams['font.sans-serif'] = 'SimHei'
Firm = pd.read_csv("Firm_amended.csv")
Firm['Code'] = Firm['Code'].astype('string')
Firm.fillna(0, inplace=True)
count_prod = pd.read_csv("analysis\\count_prod.csv")
for index, row in count_prod.iterrows():
count_prod.loc[index, 'num_firm'] = sum(Firm[row['id_product']]==1)
count_prod.loc[index, 'avg_size'] = Firm.loc[Firm[row['id_product']]==1, 'Revenue_Log'].median()
print(count_prod)
# sns.scatterplot(x='count', y='avg_size',data=count_prod)
ax = plt.subplot(projection = '3d') # 创建一个三维的绘图工程
ax.scatter(count_prod['avg_size'], count_prod['num_firm'], count_prod['count'], c = 'r')
plt.show()