2 Star 2 Fork 3

QinDong/Python-Stock

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
3-盈利能力.py 860 Bytes
Copy Edit Raw Blame History
QinDong authored 2018-12-01 10:44 . New
import tushare as ts
import time
# 3、 盈利能力数据下载
'''
code,代码
name,名称
roe,净资产收益率(%)
net_profit_ratio,净利率(%)
gross_profit_rate,毛利率(%)
net_profits,净利润(万元)
esp,每股收益
business_income,营业收入(百万元)
bips,每股主营业务收入(元)
'''
df = ts.get_profit_data(2017, 4)
df.rename(columns={'name': '名称', 'net_profit_ratio': '净利率(%)', 'gross_profit_rate': '毛利率(%)', 'roe': '净资产收益率(%)',
'esp': '每股收益', 'net_profits': '净利润(万元)', 'business_income': '营业收入(百万元)', 'bips': '每股主营业务收入(元)'}, inplace=True)
# 生成形如:3-201805-盈利能力.xlsx 的表格
df.sort_values(by=['code']).to_excel('./数据-下载/3-' + time.strftime("%Y%m", time.localtime()) + '-盈利能力.xlsx')
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Qin-Dong/Python-Stock.git
git@gitee.com:Qin-Dong/Python-Stock.git
Qin-Dong
Python-Stock
Python-Stock
master

Search