Download Analyst Recommendation from HeXun
来源:互联网 发布:在线编程测试平台 编辑:程序博客网 时间:2024/06/05 21:01
import numpy as npimport scipy as spimport scipy.stats as ssimport pandas as pdimport requests as rsimport bs4df = pd.DataFrame()for i in range(51,3808): webpage = 'http://yanbao.stock.hexun.com/listnews1_'+str(i)+'.shtml' response = rs.get(webpage) soup = bs4.BeautifulSoup(response.text) links = soup.findAll('td', align="left") stock = [] institution = [] analysts = [] rating = [] date = [] for j in xrange(len(links)): if (j%5==0): stock.append(links[j].get_text().split(u'\uff1a')[0]) elif (j%5==1): institution.append(links[j].get_text()) elif (j%5==2): analysts.append(links[j].get_text()) elif (j%5==3): rating.append(links[j].get_text()) else: date.append(links[j].get_text()) ratingdata = np.array([date, stock, rating, institution, analysts]).T ratingdata = pd.DataFrame(ratingdata) ratingdata.columns = ['Date', 'Stock', 'Rating', 'Institution', 'Analysts'] df = df.append(ratingdata) filedestiny = 'analystrating.csv'df.to_csv(filedestiny, encoding='utf-8', index=False)
0 0
- Download Analyst Recommendation from HeXun
- Download from other website
- download something from slideshare
- Download From FTP
- download from free electrons
- Recommendation
- Download ebook from Syngress Publishing
- how to download from http
- C# download file from webserver
- DOWNLOAD FROM ITAB TO EXCEL
- Download Files from Web [C#]
- Download file from Web-Task1
- download chromedriver from mirror website
- Download a file from a FTP Server
- download oracle patchs from metalink by ftp
- download the flv file from youtube
- Upload/Download SAP Scripts To/From PC
- Configure Maven to Download from Nexus
- andriod移动开发
- 关于手机推送
- java 标志一个方法为过时方法
- 作业 4.17
- Oracle数据库--入门学习--表空间tablespace详解
- Download Analyst Recommendation from HeXun
- linux中qsort的使用
- 主定理
- matlab的神经网络学习入门
- Java中OutOfMemoryError与unable to create new native thread(JVM创建大量线程)的关系
- 初识UI
- Struts2异常处理
- iOS蓝牙
- acdream 1684(博弈)