analysis
This commit is contained in:
@@ -6,7 +6,6 @@ plt.rcParams['font.sans-serif'] = 'SimHei'
|
||||
|
||||
# count firm category
|
||||
count_firm = pd.read_csv("analysis\\count_firm.csv")
|
||||
count_firm = count_firm[count_firm['count'] > 4]
|
||||
print(count_firm.describe())
|
||||
|
||||
count_dcp = pd.read_csv("analysis\\count_dcp.csv",
|
||||
@@ -15,7 +14,7 @@ count_dcp = pd.read_csv("analysis\\count_dcp.csv",
|
||||
'down_id_firm': str
|
||||
})
|
||||
# print(count_dcp)
|
||||
count_dcp = count_dcp[count_dcp['count'] > 2]
|
||||
count_dcp = count_dcp[count_dcp['count'] > 20]
|
||||
|
||||
list_firm = count_dcp['up_id_firm'].tolist(
|
||||
) + count_dcp['down_id_firm'].tolist()
|
||||
@@ -53,7 +52,6 @@ for _, row in count_dcp.iterrows():
|
||||
'up_name_product': row['up_name_product'],
|
||||
'down_id_product': row['down_id_product'],
|
||||
'down_name_product': row['down_name_product'],
|
||||
# 'edge_label': f"{row['up_id_product']} {row['up_name_product']} - {row['down_id_product']} {row['down_name_product']}",
|
||||
'edge_label': f"{row['up_id_product']} - {row['down_id_product']}",
|
||||
'edge_width': k * (row['count'] - count_min),
|
||||
'count': row['count']
|
||||
@@ -87,7 +85,7 @@ nx.draw(G_firm,
|
||||
pos,
|
||||
node_size=node_size,
|
||||
labels=node_label,
|
||||
font_size=6,
|
||||
font_size=8,
|
||||
width=3,
|
||||
edge_color=colors,
|
||||
edge_cmap=cmap,
|
||||
@@ -96,7 +94,9 @@ nx.draw(G_firm,
|
||||
nx.draw_networkx_edge_labels(G_firm, pos, edge_label, font_size=6)
|
||||
sm = plt.cm.ScalarMappable(cmap=cmap, norm=plt.Normalize(vmin=vmin, vmax=vmax))
|
||||
sm._A = []
|
||||
position = fig.add_axes([0.9, 0.05, 0.01, 0.3])
|
||||
plt.colorbar(sm, fraction=0.01, cax=position)
|
||||
plt.savefig("analysis\\count_dcp_network20230526_de")
|
||||
position = fig.add_axes([0.95, 0.05, 0.01, 0.3])
|
||||
cb = plt.colorbar(sm, fraction=0.01, cax=position)
|
||||
cb.ax.tick_params(labelsize=10)
|
||||
cb.outline.set_visible(False)
|
||||
plt.savefig("analysis\\count_dcp_network")
|
||||
plt.close()
|
||||
|
||||
Reference in New Issue
Block a user