1 Star 0 Fork 4

zoonneen/edb-nbs-rsc

forked from abc-edb-fund/edb-nbs-rsc 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
config.py 4.48 KB
一键复制 编辑 原始数据 按行查看 历史
李新 提交于 2018-08-31 17:34 . 1、1.1-1.3 GDP.xls模板文件已生成
#!/usr/bin/env python 3.6.4
# -*- coding: utf-8 -*-
# @Time : 2018/8/21 15:23
# @Author : Orient
# @File : config.py
# @Software: PyCharm
trans_dict = {
'Service Production Index':'服务业生产指数',
'Business Climate':'工业企业景气',
'Consumer Confidence':'消费者信心',
'Economist Confidence':'经济学家信心',
'Composite PMI Output Index':'综合PMI产出指数',
'Price Indices':'物价',
'Government Finance':'财政',
'FXRate & Reserves':'汇率与外汇储备',
'Industry Production':'工业生产',
'Fixed Assets Investment':'固定资产投资',
'Real Estate Climate':'房地产景气',
'Domestic Trade':'国内贸易',
'Foreign Trade':'对外贸易',
'Money Supply':'货币供应量',
'by Sector':'按部门',
'date release':'发布日程',
'Production and Operation of Construction':'建筑业生产经营情况',
'Retail Sales of Consumer Goods':'社会消费品零售情况',
'Retail Sales of Goods of the Enterprises (units) above Designated Size':'限额以上企业(单位)商品零售类值',
'Foreign Investment':'外商投资',
'Foreign Trade':'对外贸易',
'Transportation':'交通运输',
'Postal':'邮电',
'Telecommunication':'通信',
'VAI':'工业增加值',
'CCI':'消费者信心指数',
'ECI':'经济学家信心指数',
'RPI':'商品零售价格指数',
'Signal':'信号',
'Indices':'指数',
'Delivery Value for Export':'出口交货值',
'Gross Output Value of Agriculture':'农业总产值',
'Time Series':'时间序列指标',
'Regional':'区域性指标',
'Sector Economic Indicators':'部门经济指标',
'Climate Indicators':'景气指标',
'World Economic Indicators':'世界经济指标',
'Price of Rural Market Fairs':'农产品集贸市场价格'
}
class translate(object):
"""docstring for translate."""
def __init__(self, ):
super(translate, self).__init__()
def trans(self,str_trans):
"""
Args:
self
Returns:
str_trans
"""
for item in trans_dict.items():
str_trans = str_trans.replace(item[0],item[1])
return str_trans
import calendar
import re
class time_transfer(object):
"""docstring for time_transfer."""
def __init__(self):
super(time_transfer, self).__init__()
self.id_time = ''
def transfer(self,time_str):
"""时间格式化
Args:
self
time_str
Returns:
self.id_time
"""
y = re.findall(r'^([0-9]{4})', time_str)[0]
m = re.findall(r'([0-9]{1,2})$', time_str)[0]
monthRange = calendar.monthrange(int(y), int(m))
day_end = f'{y}-{m}-{str(monthRange[1])}'
self.id_time = day_end
return self.id_time
import xlwt
class style_head(object):
"""docstring for ."""
def __init__(self, ):
super(style_head, self).__init__()
def style_h(self):
workbook = xlwt.Workbook(encoding='utf-8')
# 创建一个worksheet
worksheet = workbook.add_sheet('sheet1')
# 设置行格式
style_head = xlwt.XFStyle()
# 设置居中
al = xlwt.Alignment()
al.horz = 0x02 # 设置水平居中
al.vert = 0x01 # 设置垂直居中
style_head.alignment = al
# 设置背景色
pattern = xlwt.Pattern()
pattern.pattern = xlwt.Pattern.SOLID_PATTERN
pattern.pattern_fore_colour = xlwt.Style.colour_map['sea_green']
style_head.pattern = pattern
# 设置框线
borders = xlwt.Borders()
borders.left = 1
borders.left_colour = 0x09
borders.right = 1
borders.right_colour = 0x09
borders.top = 1
borders.top_colour = 0x09
borders.bottom = 1
borders.bottom_colour = 0x09
style_head.borders = borders
# 设置字体颜色
font = xlwt.Font()
font.name = u'Arial'
font.colour_index = 1
font.bold = True
style_head.font = font
return style_head
def style_d(self):
workbook = xlwt.Workbook(encoding='utf-8')
# 创建一个worksheet
worksheet = workbook.add_sheet('sheet1')
# 设置行格式
style_data = xlwt.XFStyle()
# 设置字体颜色
font = xlwt.Font()
font.name = u'微软雅黑'
font.colour_index = 0
font.bold = False
style_data.font = font
return style_data
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zoonneen/edb-nbs-rsc.git
git@gitee.com:zoonneen/edb-nbs-rsc.git
zoonneen
edb-nbs-rsc
edb-nbs-rsc
master

搜索帮助