Skip to content

[Issue]: PortfolioAnalysisSheet uses deprecated downcasting behavior in fillna/ffill/bfill #248

@myrmarachne

Description

@myrmarachne

Summary

Environment

  • QF-Lib: 4.0.4
  • Python: 3.11.9
  • pandas: 2.2.3

What happened?

When running scripts that generate tearsheets, FutureWarnings are displayed:

qf-lib\qf_lib\analysis\tearsheets\portfolio_analysis_sheet.py:358: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`                                                         
  index=time_index).ffill().fillna(0.0)

The warning appears when ffill() or fillna() is called on object dtype arrays, which triggers automatic downcasting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions