REST API调用响应(以字节为单位),如何将以字节为单位的数据转换为dataframe对象
url ='url_path with_ending_&format=csv'
response =requests.get(url, auth=(user,password), allow_redirects=True)
result = str((response.content, 'utf-8'))
data = StringIO(result)
df = pd.DataFrame(data)
答案 0 :(得分:5)
我已经通过Pandas.read_csv()解决了相同的问题
result = str(response.content, 'utf-8')
data = StringIO(result)
df = pd.read_csv(data)