使用 Python 分析財務報表
Rohan Chatterjee
Risk Modeler
sns.set_style("whitegrid")
ax = sns.lineplot(data=current_ratio,
x="Year",y='current_ratio',
hue="company", alpha=0.7)
plt.xlabel("Year")
plt.ylabel("Current Ratio")

這張圖在有限空間放入過多資訊,導致畫面擁擠

第一步,將 DataFrame 轉為長格式(melt),取得縱向資料。
「未 melt」的 DataFrame:
plot_df.head()

現在將 DataFrame melt
plot_df_melt = plot_df.melt(id_vars = ['company','Year'], var_name = "Ratio")

ax = sns.relplot(data=df_melt, x="Year",
y="value", hue="Ratio",
alpha=0.7,
col='company',
kind='line')
ax.set_ylabels('')
ax.set_xlabels('')


使用 Python 分析財務報表