code: def test_to_excess_returns(df):
      rf = 0.05
      r = df.to_returns()
  
      np.allclose(r.to_excess_returns(0), r)
  
      np.allclose(
          r.to_excess_returns(rf, nperiods=252),
          r.to_excess_returns(ffn.deannualize(rf, 252)),
      )
  
      np.allclose(r.to_excess_returns(rf), r - rf)
  
imports: import ffn
  import pandas
  import numpy
  from pytest import fixture
  from numpy.testing import assert_almost_equal
label_desc: Use image node_id 39 for calling a global function with example usage: test_to_excess_returns(df) without return types