Giter Site home page Giter Site logo

danielwangxh / a-shares-listed-companies-in-china Goto Github PK

View Code? Open in Web Editor NEW

This project forked from btujack/a-shares-listed-companies-in-china

0.0 0.0 0.0 13 KB

Python代码:爬取**大陆A股上市公司名单,并保存到数据库MySQL中

Python 100.00%

a-shares-listed-companies-in-china's Introduction

爬取**大陆A股上市公司名单,并保存到数据库MySQL中

用数据库MySQL存储结果

#爬虫流程: #1 模拟浏览器向服务器发出请求,然后处理响应,最常用的函数就是requests下面的get请求

#2 BeautifulSoup解析网页 利用pandas库中的read_html方法快速抓取网页中常见的表格型数据。 prettify()优化代码,[0]从pd.read_html返回的list中提取出DataFrame rename将中文名改为英文名,便于存储到mysql及后期进行数据分析

#3 打开数据库 但是这种安装使用的命令是 /usr/local/mysql/bin/mysql -u root -p来开启mysql // 进入mysql(要求输入mysql登录密码) mysql -u root -p // 退出mysql exit

sudo mysql.server start sudo mysql.server stop sudo mysql.server restart

建立数据库 在数据库建立存放数据的表格

#4 写入数据库

如果想把数据存储到数据库mysql中,就要借助pymysql来操作

#5 main函数循环页数

参考 #下载数据库MySQL,然后要建立一个数据库:在控制栏输入:mysql> CREATE DATABASE WADE;

#mac安装MySQL的方法可以参考文章https://blog.csdn.net/BTUJACK/article/details/83749094

#MySQL可视化软件参考https://blog.csdn.net/BTUJACK/article/details/83750137

// 进入mysql(要求输入mysql登录密码) mysql -u root -p // 退出mysql

遗留问题:MySQL数据库可视化软件SequelPro无法打开,导致无法可视化

a-shares-listed-companies-in-china's People

Contributors

btujack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.