WIP: round numeric columns only (test branch)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
herzogflorian 2026-10-07 14:51:53 +02:00
parent 4da9a02539
commit 67e0936219

View File

@ -72,6 +72,14 @@ def cmd_clean(args) -> int:
return 0
def _rounded(table: pd.DataFrame, digits: int) -> pd.DataFrame:
"""Round the numeric columns only: pandas warns when asked to round the date columns too."""
out = table.copy()
numeric = out.select_dtypes("number").columns
out[numeric] = out[numeric].round(digits)
return out
def cmd_snapshot(args) -> int:
from quantcore.data.store import DataStore
@ -98,7 +106,7 @@ def cmd_risk(args) -> int:
table = RiskService(md).asset_risk(args.symbols, freq=args.freq, window=args.window, lam=args.lam,
horizon=args.horizon, currency=args.currency)
with pd.option_context("display.width", 200, "display.max_columns", 30):
print(table.round(5).T)
print(_rounded(table, 5).T)
return 0
@ -111,7 +119,7 @@ def cmd_performance(args) -> int:
table = PerformanceService(md, s.risk_free_rate).asset_performance(args.symbols, freq=args.freq,
currency=args.currency, start=args.start)
with pd.option_context("display.width", 200, "display.max_columns", 30):
print(table.round(4).T)
print(_rounded(table, 4).T)
return 0