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

Upgrade 0.2.47 to 0.2.48 caused me an issue as if api are returning data frame instead of series #2150

Closed
MarcoOvidi opened this issue Nov 25, 2024 · 2 comments

Comments

@MarcoOvidi
Copy link

Describe bug

Hello,

in my cod I did: df = yfinance.download(titolo, start=start_date, end=None, progress=False)

that inversion 0.2.47 the object df['Close] was a series, now from version 0.2.48 seems that df['Close] is returning a data frame.

Do you know why and how I can solve ? Is an issue or something changed ?

Br
Marco

Simple code that reproduces your problem

with x.x.47

df = yfinance.download(titolo, start=start_date, end=None, progress=False)
type(df['Close]') is a series

with x.x.48

df = yfinance.download(titolo, start=start_date, end=None, progress=False)
type(df['Close]') is a dataframe

Debug log

with 0.2.47:

EBUG Entering download()
DEBUG Disabling multithreading because DEBUG logging enabled
DEBUG Entering history()
DEBUG Entering history()
DEBUG 1AGS.MI: Yahoo GET parameters: {'period1': '2016-09-08 00:00:00+02:00', 'period2': '2024-11-25 19:46:33+01:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG Entering get()
DEBUG Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/1AGS.MI
DEBUG params={'period1': 1473285600, 'period2': 1732560393, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG loaded persistent cookie
DEBUG reusing cookie
DEBUG crumb = '9A50X2zLXJa'
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=200
DEBUG Exiting _make_request()
DEBUG Exiting get()
DEBUG 1AGS.MI: yfinance received OHLC data: 2016-09-08 07:00:00 -> 2024-11-25 16:26:05
DEBUG 1AGS.MI: OHLC after cleaning: 2016-09-08 09:00:00+02:00 -> 2024-11-25 17:26:05+01:00
DEBUG 1AGS.MI: OHLC after combining events: 2016-09-08 00:00:00+02:00 -> 2024-11-25 00:00:00+01:00
DEBUG 1AGS.MI: yfinance returning OHLC: 2016-09-08 00:00:00+02:00 -> 2024-11-25 00:00:00+01:00
DEBUG Exiting history()
DEBUG Exiting history()
DEBUG Exiting download()

with 0.2.48:

DEBUG Entering history()
DEBUG 1AGS.MI: Yahoo GET parameters: {'period1': '2016-09-08 00:00:00+02:00', 'period2': '2024-11-25 19:47:09+01:00', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG Entering get()
DEBUG Entering _make_request()
DEBUG url=https://query2.finance.yahoo.com/v8/finance/chart/1AGS.MI
DEBUG params={'period1': 1473285600, 'period2': 1732560429, 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG Entering _get_cookie_and_crumb()
DEBUG cookie_mode = 'basic'
DEBUG Entering _get_cookie_and_crumb_basic()
DEBUG loaded persistent cookie
DEBUG reusing cookie
DEBUG crumb = '9A50X2zLXJa'
DEBUG Exiting _get_cookie_and_crumb_basic()
DEBUG Exiting _get_cookie_and_crumb()
DEBUG response code=200
DEBUG Exiting _make_request()
DEBUG Exiting get()
DEBUG 1AGS.MI: yfinance received OHLC data: 2016-09-08 07:00:00 -> 2024-11-25 16:26:05
DEBUG 1AGS.MI: OHLC after cleaning: 2016-09-08 09:00:00+02:00 -> 2024-11-25 17:26:05+01:00
DEBUG 1AGS.MI: OHLC after combining events: 2016-09-08 00:00:00+02:00 -> 2024-11-25 00:00:00+01:00
DEBUG 1AGS.MI: yfinance returning OHLC: 2016-09-08 00:00:00+02:00 -> 2024-11-25 00:00:00+01:00
DEBUG Exiting history()
DEBUG Exiting history()
DEBUG Exiting download()

Bad data proof

No response

yfinance version

0.2.47

Python version

No response

Operating system

No response

@MarcoOvidi
Copy link
Author

attrs==24.2.0
beautifulsoup4==4.12.3
certifi==2024.8.30
charset-normalizer==3.4.0
frozendict==2.4.6
h11==0.14.0
html5lib==1.1
idna==3.10
lxml==5.3.0
multitasking==0.0.11
numpy==2.1.3
outcome==1.3.0.post0
packaging==24.2
pandas==2.2.3
peewee==3.17.8
platformdirs==4.3.6
PySocks==1.7.1
python-dateutil==2.9.0.post0
python-dotenv==1.0.1
pytz==2024.2
requests==2.32.3
selenium==4.27.0
setuptools==75.6.0
six==1.16.0
sniffio==1.3.1
sortedcontainers==2.4.0
soupsieve==2.6
ta==0.11.0
tabulate==0.9.0
trio==0.27.0
trio-websocket==0.11.1
typing_extensions==4.12.2
tzdata==2024.2
urllib3==2.2.3
webdriver-manager==4.0.2
webencodings==0.5.1
websocket-client==1.8.0
wsproto==1.2.0
yfinance==0.2.47

@dhruvan2006
Copy link
Contributor

Duplicate of #2101 (comment)

Behavior of yf.download() has been changed

@ValueRaider ValueRaider closed this as not planned Won't fix, can't repro, duplicate, stale Nov 25, 2024
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