Python 什么是;ValueError:没有要连接的对象;我的意思是,我怎样才能修复它?

Python 什么是;ValueError:没有要连接的对象;我的意思是,我怎样才能修复它?,python,pandas,google-trends,Python,Pandas,Google Trends,我试着从谷歌趋势的g表中获取数据。第一次运行平稳,第二次运行不太平稳。我收到一个错误,名为: ValueError:没有要连接的对象 我以前在堆栈溢出上搜索过此错误,但找不到任何解决方案。我使用下面显示的代码: !pip install Pytrends !pip install pandas !pip install pytrends --upgrade <---------Note: this solved a different error. from pytrends.reques

我试着从谷歌趋势的g表中获取数据。第一次运行平稳,第二次运行不太平稳。我收到一个错误,名为:

ValueError:没有要连接的对象

我以前在堆栈溢出上搜索过此错误,但找不到任何解决方案。我使用下面显示的代码:

!pip install Pytrends
!pip install pandas
!pip install pytrends --upgrade <---------Note: this solved a different error.
from pytrends.request import TrendReq
import pandas as pd
import time
startTime = time.time()
pytrend = TrendReq(hl='nl-NL', tz=360)
df = wb = gc.open_by_url('https://docs.google.com/spreadsheets/d/1QE1QilM-GDdQle6eVunepqG5RNWv39xO0By84C19Ehc/edit?usp=sharing')
sheet = wb.sheet1
df2 = sheet.col_values(5)
d_from = sheet.acell('B7').value
d_to = sheet.acell('B8').value
geo1 = sheet.acell('B10').value
dataset = []
for x in range(1,len(df2)):
     keywords = [df2[x]]
     pytrend.build_payload(
     kw_list=keywords,
     cat=0,
     timeframe= str(d_from + " " + d_to),
     geo= str(geo1))
     data = pytrend.interest_over_time()
     if not data.empty:
          data = data.drop(labels=['isPartial'],axis='columns')
          dataset.append(data)
result = pd.concat(dataset, axis=1)
result.to_csv('search_trends_DOWNLOAD_ME.csv')
!cp search_trends_DOWNLOAD_ME.csv "/content/drive/My Drive/Colab Notebooks/Output"
executionTime = (time.time() - startTime)
print('Execution time in sec.: ' + str(executionTime))
!pip安装Pytrends
!安装熊猫
!pip安装pytrends——升级27结果=pd.concat(数据集,axis=1)
28.搜索结果到csv('搜索趋势\下载\ ME.csv')
29 get_ipython().system('cp search_trends_DOWNLOAD_ME.csv”/content/drive/My drive/Colab Notebooks/Output“)
1帧
/usr/local/lib/python3.6/dist-packages/pandas/core/reformate/concat.py in_uuuuuinit_uuu(self、objs、axis、join、key、levels、names、ignore_uindex、verify_uintegrity、copy、sort)
327
328如果len(objs)==0:
-->329 raise VALUERROR(“没有要连接的对象”)
330
331如果密钥为“无”:
ValueError:没有要连接的对象

我使用的关键字位于
df=wb=gc中。这是一张g-sheet,上面有位置、语言和关键字。

似乎您的
数据集
是空的,请尝试更早地将其打印到屏幕上,类似地,
df
df2
@Maciek我应该将“dataset=[]”放在“df2”之前吗?那行吗?它不会改变任何事情。也许试试我的建议。@Maciek对不起,我不太明白你用“早”这个词的意思。这是我有史以来的第一个代码,所以如果建议做什么,我不知道该做什么,没有例子。这就是我在阅读关于这个问题的所有其他问题时所面临的问题。感谢您到目前为止的反应:)我的意思是您可以将这些变量打印到屏幕上,而不是移动当前指令。