码迷,mamicode.com
首页 > 其他好文 > 详细

ValueError: DataFrame constructor not properly called! (求大神指教)

时间:2020-05-24 13:44:33      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:步骤   amp   port   called   bsp   代码   获取   eth   das   


#代码设计:步骤一:获取网页信息。步骤二:对数据进行帅选。部署三对数据进行打印
import requests
import re
import pandas as pd
def GetHtml(url):
try:
r=requests.get(url)
r.raise_for_status()
r.encoding=r.raise_for_status()
return r.text
except:
return ‘网络异常‘
def Getinfo(list,html):
pattern=re.compile(r‘class="wsod_symbol">(.*?)<\/a>&nbsp.*?>(.*?)<\/span>.*\n.*?class="wsod_stream">(.*?)<\/span><\/td>‘)
info_text=pattern.findall(html)
for item in info_text:
list.append(item)
return "list"
def InfoList(infolist):
info_text=pd.DataFrame(infolist)
print(info_text)
def main():
infolist=[]
url=‘http://money.cnn.com/data/dow30/‘
html=GetHtml(url)
info=Getinfo(infolist, html)
InfoList(info)
main()

ValueError: DataFrame constructor not properly called! (求大神指教)

标签:步骤   amp   port   called   bsp   代码   获取   eth   das   

原文地址:https://www.cnblogs.com/baoerdeyidongchengbao/p/12950461.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!