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

Incorrect Dates on investpy.economic_calendar #603

Open
sobcza11 opened this issue Sep 18, 2022 · 1 comment
Open

Incorrect Dates on investpy.economic_calendar #603

sobcza11 opened this issue Sep 18, 2022 · 1 comment

Comments

@sobcza11
Copy link

sobcza11 commented Sep 18, 2022

Hello,

Before I begin, investpy is awesome & helped tremendously on one of my Data Science capstone projects; big fan of the work on investpy.

That said, I am experiencing some issues on the dates for investpy.economic_calendar; notably some are wrong. I included my Python code below for reference as to what I am puling. I will note, it is a long time horizon.

today_d_m_y = now.strftime("%d/%m/%Y")

us_econ = pd.DataFrame([])
us_econ = investpy.economic_calendar(
countries = ['United States'],
categories = ['date', 'time','zone', 'importance', 'event', 'actual', 'forecast'],
from_date = '01/01/2005', to_date = today_d_m_y)

us_econ = us_econ[::-1]
us_econ = us_econ.sort_values(by=['date'], ascending=False)
us_econ = us_econ.reset_index(drop=True)

I put all of this into an excel & pull separate economic items separately. Below is an example on US CPI (YoY).

us_cpi = pd.DataFrame([])
us_cpi = us_econ[us_econ['event'].str.startswith('CPI (YoY)')]

some come as only CPI (YoY) but most have the relevant date behind it; the below shows only those with the date behind it

us_cpi = us_cpi.loc[us_cpi["event"] != 'CPI (YoY)' ]

us_cpi = us_cpi.reset_index(drop=True)
us_cpi = us_cpi.sort_values(by=['date'], ascending=False)

This code shows a 2022-12-04 ( which hasn't happened yet...now is 18 Sept 2022 ) for CPI (YoY) (Mar). I included some screen shots. That said, that could be structured as YYYY-DD-MM " but" another further below (8) has the structure different as YYYY-MM-DD. The confusion lays in the flip flop.

1_investpy
2_investpy
3_investpy
4_investpy

Any thoughts or possible errors I'm making to make it work?

Please advise.

Rand

@sobcza11
Copy link
Author

@alvarobartt Any thoughts?

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

1 participant