Skip to content

Commit

Permalink
Move FRED saves to DATA_DIR
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbejara committed Aug 6, 2024
1 parent 0af2b54 commit 8619051
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 11,884 deletions.
31 changes: 25 additions & 6 deletions src/03_factor_analysis_demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@
"import statsmodels.multivariate.pca"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import config\n",
"DATA_DIR = config.DATA_DIR"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -112,7 +122,7 @@
"metadata": {},
"outputs": [],
"source": [
"df.to_csv('fred_panel.csv')"
"df.to_csv(DATA_DIR / 'fred_panel.csv')"
]
},
{
Expand All @@ -121,7 +131,7 @@
"metadata": {},
"outputs": [],
"source": [
"dff = pd.read_csv('fred_panel.csv')"
"dff = pd.read_csv(DATA_DIR / 'fred_panel.csv')"
]
},
{
Expand All @@ -139,7 +149,7 @@
"metadata": {},
"outputs": [],
"source": [
"dff = pd.read_csv('fred_panel.csv', parse_dates=['DATE'])"
"dff = pd.read_csv(DATA_DIR / 'fred_panel.csv', parse_dates=['DATE'])"
]
},
{
Expand All @@ -166,7 +176,7 @@
"metadata": {},
"outputs": [],
"source": [
"df.to_parquet('fred_panel.parquet')"
"df.to_parquet(DATA_DIR / 'fred_panel.parquet')"
]
},
{
Expand All @@ -175,7 +185,7 @@
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_parquet('fred_panel.parquet')"
"df = pd.read_parquet(DATA_DIR / 'fred_panel.parquet')"
]
},
{
Expand Down Expand Up @@ -624,7 +634,7 @@
"metadata": {},
"outputs": [],
"source": [
"data = yf.download(\" \".join(tickers), start=\"1980-01-01\", end=\"2023-08-01\")"
"data = yf.download(\" \".join(tickers), start=\"1980-01-01\", end=\"2024-08-01\", progress=False)"
]
},
{
Expand Down Expand Up @@ -662,6 +672,15 @@
"df = df.drop(columns=cols_with_many_nas).dropna().pct_change().dropna()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"df.columns"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down
Loading

0 comments on commit 8619051

Please sign in to comment.