用 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 分析财务报表