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

Pandas deprecation warning #1837

Closed
uzala92 opened this issue Jan 22, 2024 · 6 comments
Closed

Pandas deprecation warning #1837

uzala92 opened this issue Jan 22, 2024 · 6 comments

Comments

@uzala92
Copy link

uzala92 commented Jan 22, 2024

Describe bug

venv/lib/python3.10/site-packages/yfinance/utils.py:775: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.
df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')

venv/lib/python3.10/site-packages/yfinance/base.py:291: FutureWarning: 'T' is deprecated and will be removed in a future version, please use 'min' instead.

Simple code that reproduces your problem

N/A

Debug log

N/A

Bad data proof

No response

yfinance version

0.2.36

Python version

3.10

Operating system

Linux

@cemsbr
Copy link

cemsbr commented Jan 25, 2024

In my case:

lib/python3.12/site-packages/yfinance/utils
.py:775: FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed 
in a future version. Use pd.to_timedelta instead.                                                           
  df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')

@louiskenyon98
Copy link

louiskenyon98 commented Jan 30, 2024

I have this issue and it is preventing me from using the df.download() function.

@tecodrive
Copy link

same problem, after upgrade pandas

.../.local/lib/python3.10/site-packages/yfinance/utils.py:775

FutureWarning: The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed
in a future version. Use pd.to_timedelta instead.

df.index += _pd.TimedeltaIndex(dst_error_hours, 'h')

@cemsbr
Copy link

cemsbr commented Feb 4, 2024

Workaround: add the following before using yfinance (i.e. in src/__init__.py):

import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)

@janfrederik
Copy link

Workaround: add the following before using yfinance (i.e. in src/__init__.py):

import warnings
warnings.simplefilter(action="ignore", category=FutureWarning)

Maybe best to be just a little bit more specific, so that warnings for the rest of your code are not hidden:

import warnings
warnings.filterwarnings("ignore", category=FutureWarning, module="yfinance")

or ultra specific:

import warnings
warnings.filterwarnings("ignore", message="The 'unit' keyword in TimedeltaIndex construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.", category=FutureWarning, module="yfinance.utils")

@ValueRaider
Copy link
Collaborator

Fixed in dev branch #1844.

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

6 participants