Skip to content

Commit 401b2ee

Browse files
mmckyHumphreyYang
andauthored
Update lectures/polars.md
Co-authored-by: Humphrey Yang <[email protected]>
1 parent 2d4c312 commit 401b2ee

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lectures/polars.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -812,10 +812,15 @@ yearly_returns_pd = yearly_returns.to_pandas().set_index('year')
812812
813813
fig, axes = plt.subplots(2, 2, figsize=(10, 8))
814814
815-
for iter_, ax in enumerate(axes.flatten()): # Flatten 2-D array to 1-D array
815+
# Flatten 2-D array to 1-D array
816+
for iter_, ax in enumerate(axes.flatten()):
816817
if iter_ < len(yearly_returns_pd.columns):
817-
index_name = yearly_returns_pd.columns[iter_] # Get index name per iteration
818-
ax.plot(yearly_returns_pd[index_name]) # Plot pct change of yearly returns per index
818+
819+
# Get index name per iteration
820+
index_name = yearly_returns_pd.columns[iter_]
821+
822+
# Plot pct change of yearly returns per index
823+
ax.plot(yearly_returns_pd[index_name])
819824
ax.set_ylabel("percent change", fontsize = 12)
820825
ax.set_title(index_name)
821826

0 commit comments

Comments
 (0)