Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 附加到for循环中的数据帧_Python_Json_Python 3.x_Http_Get - Fatal编程技术网

Python 附加到for循环中的数据帧

Python 附加到for循环中的数据帧,python,json,python-3.x,http,get,Python,Json,Python 3.x,Http,Get,我有一个csv文件中的数据,我想在其中对csv中的每一行执行一个HTTP GET请求,并将请求的结果存储在一个数据帧中 以下是我目前的工作内容: with open('input.csv') as csv_file: csv_reader = csv.DictReader(csv_file) df = pd.DataFrame() for row in csv_reader: result = requests.get(BASEURL+row['ID']+"&access_tok

我有一个csv文件中的数据,我想在其中对csv中的每一行执行一个HTTP GET请求,并将请求的结果存储在一个数据帧中

以下是我目前的工作内容:

with open('input.csv') as csv_file:
csv_reader = csv.DictReader(csv_file)
df = pd.DataFrame()
for row in csv_reader:
    result = requests.get(BASEURL+row['ID']+"&access_token="+TOKEN).json()
    data = pd.DataFrame(result)
    df.append(data)
然而,这似乎没有附加到df


请注意,json响应将始终返回id、first\u name、last\u name键值对。

追加操作将返回一个包含追加数据的新数据帧。 将最后一行更改为:

df = df.append(data)

共享输入csv文件,即用于测试的url。你有什么错误吗?