mirror of
https://github.com/PR0M3TH3AN/python_charts.git
synced 2026-10-27 08:50:39 +00:00
Enhance documentation and scripts for handling UNRATE null values
- Add policy for managing NaN values in UNRATE series to AGENTS.md. - Update README.md with new chart script details and usage instructions. - Modify `lagged_oil_unrate_chart_styled.py` to implement clamping to last valid index for UNRATE data. - Introduce new script `bitcoin_m2_chart.py` for Bitcoin vs. global M2 overlay chart. - Ensure all scripts maintain data integrity by avoiding estimates for current month.
This commit is contained in:
1 parent
2c576c330f
commit
e5b1d091c5
9 files changed
+305
-111
No files matched your search
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python3
|
||||
"""custom_chart.py
|
||||
------------------
|
||||
Plot arbitrary FRED series stored in ``data/fred.db``.
|
||||
"""
|
||||
custom_chart.py
|
||||
---------------
|
||||
Plot arbitrary FRED series stored in `data/fred.db`.
|
||||
|
||||
Example:
|
||||
python scripts/custom_chart.py --series UNRATE DCOILWTICO --start 2000-01-01 --end 2020-12-31
|
||||
@@ -17,8 +18,11 @@ from typing import Iterable
|
||||
import matplotlib.dates as mdates
|
||||
import matplotlib.pyplot as plt
|
||||
import pandas as pd
|
||||
|
||||
# IMPORTANT: import common directly (no "scripts." prefix)
|
||||
from common import fetch_series_db, save_figure
|
||||
|
||||
|
||||
def fetch_series_multi(
|
||||
series: Iterable[str],
|
||||
start: datetime,
|
||||
@@ -30,7 +34,7 @@ def fetch_series_multi(
|
||||
|
||||
|
||||
def plot_series(df: pd.DataFrame) -> plt.Figure:
|
||||
"""Plot each column of ``df`` on a shared axis."""
|
||||
"""Plot each column of `df` on a shared axis."""
|
||||
fig, ax = plt.subplots(figsize=(10, 5))
|
||||
for col in df.columns:
|
||||
ax.plot(df.index, df[col], label=col)
|
||||
|
||||
Reference in new issue
Block a user