vendredi 6 mars 2020

ValueError: Length mismatch: Expected axis has 0 elements, new values have 3 elements

I am using pytrends to scrape some data points and using a loop to update df1 every time. I am initializing df1 every time with pytrends data so why is it prompting that df1 has 0 columns?

A part of the code is as below-

for i in range(0,len(set5)):
 for j in range(0,len(set5)):
  l1=[]
  l2=[]
  if((i==j) or ((i==0) and (j==1))):
     continue
  else:
     kw_list = [set5[i],set5[j]]
     time.sleep(4) 
     pytrends.build_payload(kw_list, cat=47, timeframe='2008-1-1 2018-12-31', geo='US', gprop='')
     df1=pytrends.interest_over_time()
     df1.columns=['Car Model 1 Web Search', 'Car Model 2 Web Search', 'ispart1']

Aucun commentaire:

Enregistrer un commentaire