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

Too many "FutureWarning" #44

Closed
ana-jiangR opened this issue Oct 14, 2023 · 2 comments
Closed

Too many "FutureWarning" #44

ana-jiangR opened this issue Oct 14, 2023 · 2 comments

Comments

@ana-jiangR
Copy link

my test code is like this #43 (when setting threads=False)

the warning logs:

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:482: FutureWarning: Series.getitem treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
last_open_day = sched["open"][-1].date()

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_prices_manager.py:647: FutureWarning: Series.getitem treating keys as positions is deprecated.
In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
fetch_dt = yfct.ConvertToDatetime(self.h["FetchDate"][idx], tz=tz_exchange)

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:816: FutureWarning: Series.getitem treating keys as positions is deprecated.
In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
if ts < sched["open"][i]:

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:818: FutureWarning: Series.getitem treating keys as positions is deprecated.
In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
return {"market_open": sched["open"][i].to_pydatetime().astimezone(tz), "market_close": sched["close"][i].to_pydatetime().astimezone(tz)}

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:1087: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas.
Value 'DatetimeIndex(['2022-10-14 09:30:00-04:00', '2022-10-14 10:30:00-04:00',
'2022-10-14 11:30:00-04:00', '2022-10-14 12:30:00-04:00',
'2022-10-14 13:30:00-04:00', '2022-10-14 14:30:00-04:00',
'2022-10-14 15:30:00-04:00', '2022-10-17 09:30:00-04:00',
'2022-10-17 10:30:00-04:00', '2022-10-17 11:30:00-04:00',
...
'2023-10-12 13:30:00-04:00', '2023-10-12 14:30:00-04:00',
'2023-10-12 15:30:00-04:00', '2023-10-13 09:30:00-04:00',
'2023-10-13 10:30:00-04:00', '2023-10-13 11:30:00-04:00',
'2023-10-13 12:30:00-04:00', '2023-10-13 13:30:00-04:00',
'2023-10-13 14:30:00-04:00', '2023-10-13 15:30:00-04:00'],
dtype='datetime64[ns, America/New_York]', length=1751, freq=None)' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
intervals.loc[intervals.index[f], "interval_open"] = tis.left[idx[f]].tz_convert(tz)

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:1088: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas.
Value 'DatetimeIndex(['2022-10-14 10:30:00-04:00', '2022-10-14 11:30:00-04:00',
'2022-10-14 12:30:00-04:00', '2022-10-14 13:30:00-04:00',
'2022-10-14 14:30:00-04:00', '2022-10-14 15:30:00-04:00',
'2022-10-14 16:00:00-04:00', '2022-10-17 10:30:00-04:00',
'2022-10-17 11:30:00-04:00', '2022-10-17 12:30:00-04:00',
...
'2023-10-12 14:30:00-04:00', '2023-10-12 15:30:00-04:00',
'2023-10-12 16:00:00-04:00', '2023-10-13 10:30:00-04:00',
'2023-10-13 11:30:00-04:00', '2023-10-13 12:30:00-04:00',
'2023-10-13 13:30:00-04:00', '2023-10-13 14:30:00-04:00',
'2023-10-13 15:30:00-04:00', '2023-10-13 16:00:00-04:00'],
dtype='datetime64[ns, America/New_York]', length=1751, freq=None)' has dtype incompatible with datetime64[ns], please explicitly cast to a compatible dtype first.
intervals.loc[intervals.index[f], "interval_close"] = tis.right[idx[f]].tz_convert(tz)

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_prices_manager.py:805: FutureWarning: Series.getitem treating keys as positions is deprecated.
In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
if (not h_intervals.empty) and isinstance(h_intervals["interval_open"][0], datetime):

C: \miniconda3\envs\yfinance\lib\site-packages\yfinance_cache\yfc_time.py:482: FutureWarning: Series.getitem treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use ser.iloc[pos]
last_open_day = sched["open"][-1].date()


I'm using Window 11 OS.
my Python version:
Python 3.9.18 (main, Sep 11 2023, 14:09:26) [MSC v.1916 64 bit (AMD64)] on win32

see dependences' version:
yfance_cache (0.4.7)
yfance (0.2.31)
pandas (2.1.1)
exchange-calendars (4.5)
scipy (1.10.1)
click (8.1.7)
numpy (1.26.0)
pyluach (2.2.0)
python-dateutil (2.8.2)
toolz (0.12.0)
tzdata (2023.3)
korean-lunar-calendar (0.3.1)
pytz (2023.3.post1)
requests (2.31.0)
multitaskg(0.0.11)
lxml (4.9.3)
appdirs (1.4.4)
frozendict(2.3.8)
peewee (3.16.3)
beautifulsoup4 (4.12.2)
html5lib (1.1)
colorama (0.4.4)
soupsieve>1.2 (2.5)
six>=1.9 (1.16.0)
webencodgs (0.5.1)
charset-normalizer (3.3.0)
idna(3.4)
urllib3 (1.26.17)
certifi (2023.7.22)

@ValueRaider
Copy link
Owner

Workaround is downgrade pandas to 2.0.3

@ValueRaider
Copy link
Owner

Many fixed in 0.4.8, but I also had to treat Pandas version 2.1+ as broken - pandas-dev/pandas#55487

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

2 participants