code: def test_to_monthly():
      a = pd.Series(
          range(100), index=pd.date_range("2010-01-01", periods=100)
      )
      # to test for actual dates
      a["2010-01-31"] = np.nan
      a = a.dropna()
  
      actual = a.to_monthly()
  
      assert len(actual) == 3
      assert "2010-01-30" in actual
      assert actual["2010-01-30"] == 29
  
imports: import ffn
  import pandas
  import numpy
  from pytest import fixture
  from numpy.testing import assert_almost_equal
label_desc: Use image node_id 25 for calling a global function with example usage: test_to_monthly() without return types