Closed erwanlenagard closed 4 years ago
Hi! Can you please paste the whole snippet of code so I can reproduce the function call that caused the exception? Can you also give me the versions of your python packages (most notably pandas and numpy)?
Hello,
Thanks a lot ! Here are packages versions : pandas==1.1.2 numpy==1.19.2
And my code :
import os import pandas as pd import gtab
projet = "monprojet" file="C:/Users/Erwan/Documents/scripts/scripts_python/Google Trends/input.csv" path="C:/Users/Erwan/Documents/scripts/scripts_python/Google Trends/"+projet
geo="FR" date_debut="2020-03-05" date_fin="2020-05-05"
if not os.path.exists(path): os.makedirs(path)
df_input=pd.read_csv(file, sep=';',index_col=None, encoding = "utf-8")
t = gtab.GTAB() timeframe=date_debut+" "+date_fin print("set options") t.set_options(pytrends_config={"geo": geo, "timeframe": timeframe}) print("create anchorbank") t.create_anchorbank() print("set active gtab") t.set_active_gtab("google_anchorbank_geo="+geo+"_timeframe="+timeframe+".tsv") print("requete DF") results=pd.DataFrame() for i,row in df_input.iterrows(): result_tmp=t.new_query(row["query"]) result_tmp["query"]=row["query"] result_tmp.reset_index(inplace=True) results=pd.concat([results,result_tmp],ignore_index=True,sort=True)
names=results.columns results.to_csv(path+"/"+projet+"_resultats.csv",header=names, sep=';',encoding='utf-8',index=False, decimal="," )
Hi Erwan! The bug was caused because for some reason pd.DataFrame.max() didn't return a numpy.int32 object, but instead returned a simple int object. I'm not sure why it doesn't use numpy types on your python config.
In any case, I've hopefully fixed the bug, please test it out and close the issue if it works now. :) Thanks for the bug catch!
Thanks a lot ! It works ! :)
Hello,
I tried to create a new anchor bank, but It returned this error. How can i solve this ?
AttributeError Traceback (most recent call last)