Skip to content
This repository was archived by the owner on Apr 17, 2025. It is now read-only.

Fix interest_over_time warning - #627

Open
AD (danaiamirali) wants to merge 1 commit into
GeneralMills:masterfrom
danaiamirali:master
Open

Fix interest_over_time warning#627
AD (danaiamirali) wants to merge 1 commit into
GeneralMills:masterfrom
danaiamirali:master

Conversation

@danaiamirali

Copy link
Copy Markdown

With pandas==2.2.0, running an interest_over_time() request (a specific one is shown below) leads to the following FutureWarning error from pandas:

from pytrends.request import TrendReq

pytrend = TrendReq(hl='en-US', tz=360)

kw_list = ["D23"]

pytrend.build_payload(kw_list, timeframe='now 1-H')

interest_over_time_df = pytrend.interest_over_time()

print(interest_over_time_df)

C:\Documents\GitHub\Projects\pytrends\pytrends\request.py:266: FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set pd.set_option('future.no_silent_downcasting', True)
df = df.fillna(False)

This PR fixes the appearance of this warning with a one line addition.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants