Skip to content

Instantly share code, notes, and snippets.

@HumanRupert
Last active January 22, 2021 08:43
Show Gist options
  • Save HumanRupert/136abb5df1735c677d9d81bf1edfb345 to your computer and use it in GitHub Desktop.
Save HumanRupert/136abb5df1735c677d9d81bf1edfb345 to your computer and use it in GitHub Desktop.
Visualize factors for Fama-French Three Factor Modal
from datetime import datetime
import pandas as pd
import numpy as np
from matplotlib import pyplot as plt
factors = pd.read_csv("./factors.csv", index_col="Date")
# convert Date index to datetime object
factors.index= pd.to_datetime(factors.index, format="%Y%m%d")
# calculate cumulative sum of factors
factors_cum = factors.cumsum()
factors_cum.plot.line()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment