Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: Invalid frequency: ME when using qs.reports.html #32

Open
tampaguy2012 opened this issue May 7, 2024 · 3 comments
Open

Comments

@tampaguy2012
Copy link

I'm encountering a ValueError: Invalid frequency: ME when using the qs.reports.html function. This error seems to be generated internally within the library, even when I provide a valid integer value for the periods_per_year argument.

Steps to Reproduce

Import libraries

import pandas as pd
import quantstats_lumi as qs

Create Sample Data

dates = pd.date_range('2023-05-01', periods=10)
portfolio_data = [1.02, 0.98, 1.05, 1.01, 1.03, 0.97, 0.99, 1.06, 1.0, 0.99]
benchmark_data = [1.01, 0.99, 1.03, 1.02, 1.06, 0.96, 0.98, 1.05, 0.98, 1.0]

portfolio = pd.Series(portfolio_data, index=dates, name="Port")
bench = pd.Series(benchmark_data, index=dates, name='SPY')

Attempt to generate the report:

qs.reports.html(portfolio, benchmark=bench, output='test_output.html', periods_per_year=365)

The above code produces the following traceback (shortened for clarity):

ValueError: Invalid frequency: ME

@tampaguy2012
Copy link
Author

I've tried the following troubleshooting steps:

  • Ensuring the periods_per_year argument is a valid integer.
  • Restarting my runtime environment.
  • Inspecting my code for any potential sources of the "ME" string.

@grzesir
Copy link
Contributor

grzesir commented May 7, 2024 via email

@bibib2211
Copy link

I have the same issue, have verified that the error occurs even with the latest version of pandas. Pandas documentation https://pandas.pydata.org/docs/whatsnew/v2.2.0.html#deprecate-aliases-m-q-y-etc-in-favour-of-me-qe-ye-etc-for-offsets suggests these are the frequency strings that should be in use, not sure what is going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants