分行业能源消费总量(年度) (cn_macro_energy_consumption_industry_yearly)

数据描述: 国家统计局年度分行业能源消费总量,能源折标准煤合计及 9 种能源品种在 50 多个行业的全年消费量,2000 年起,保留历史修订版本

文档
数据简介

# 分行业能源消费总量(年度)数据说明 ## 一、数据简介 本表记录国家统计局发布的年度分行业能源消费总量,一年的一种能源品种在一个行业一行,只有全年消费总量一个数值。 覆盖 10 种能源品种(折标准煤的能源合计,以及煤炭、焦炭、原油、汽油、煤油、柴油、燃料油、天然气、电力)和 50 多个行业,行业从农林牧渔、工业、建筑业到居民生活,工业下又分采矿业、制造业的 30 多个门类和电力热力燃气及水生产供应业。 保留历史修订版本:同一年的数据被修订后新增一行,旧行保留,可以按 `date` 取任意时点当时已知的值。 全国分品种的消费量见 `cn_macro_energy_consumption_yearly`,分品种的平衡表见 `cn_macro_energy_balance_yearly`。 - 数据来源:国家统计局“国家数据”年度数据库“能源”节点下的 10 个“分行业<品种>消费总量”类目,公布时间见“公布时间与修订”一节 - 数据起始年份:`{{data_start_date}}`;数据最新年份:`{{data_end_date}}`。各品种和行业的起止年份见“取值”一节 - 更新频率:年度。分行业的细项通常比全国合计晚一两年,所以最新几年只有部分行业和品种 ## 二、主键说明 | 关键字 | 释意 | | --- | --- | | date | 公布日期,本表首次抓到该版本数据的日期,不是统计局公告日期 | | report_date | 报告期,取当年 12 月 31 日,如 2023-12-31 表示 2023 年 | | energy_code | 能源品种代码 | | industry_code | 行业代码 | ## 三、字段说明 | 字段 | 释意 | | --- | --- | | date | 公布日期;上线前的历史年份按报告期末日后 330 天估算,年份被修订后新增一行,`date` 为抓到修订数据的日期 | | report_date | 报告期,取当年 12 月 31 日 | | energy_code | 能源品种代码,`energy` 是折算为标准煤的能源合计 | | energy_name | 能源品种名称,国家统计局口径 | | industry_code | 行业代码,`total` 是各部门和居民生活的合计 | | industry_name | 行业名称,国家统计局口径,合计记为“合计” | | parent_industry_code | 上一级行业代码,合计没有上一级,为空 | | unit | `value` 的计量单位,每种能源品种固定一个 | | value | 全年消费总量,单位见 `unit` | ## 四、取值 ### 能源品种 | energy_code | 名称 | 单位 | 起止年份 | | --- | --- | --- | --- | | energy | 能源 | 万吨标准煤 | 2000-2025 | | coal | 煤炭 | 万吨 | 2000-2023 | | coke | 焦炭 | 万吨 | 2000-2023 | | crude_oil | 原油 | 万吨 | 2000-2023 | | gasoline | 汽油 | 万吨 | 2000-2023 | | kerosene | 煤油 | 万吨 | 2000-2023 | | diesel | 柴油 | 万吨 | 2000-2023 | | fuel_oil | 燃料油 | 万吨 | 2000-2023 | | natural_gas | 天然气 | 亿立方米 | 2000-2023 | | electricity | 电力 | 亿千瓦小时 | 2000-2023 | ### 行业 | industry_code | 名称 | 上一级 | 起止年份 | | --- | --- | --- | --- | | total | 合计 | 无 | 2000-2025 | | agriculture | 农、林、牧、渔业 | total | 2000-2024 | | industry | 工业 | total | 2000-2024 | | construction | 建筑业 | total | 2000-2024 | | transport_storage_postal | 交通运输、仓储和邮政业 | total | 2000-2024 | | wholesale_retail_hospitality | 批发和零售业、住宿和餐饮业 | total | 2000-2023 | | other | 其他 | total | 2000-2024 | | residential | 居民生活 | total | 2000-2024 | | mining | 采矿业 | industry | 2000-2023 | | coal_mining | 煤炭开采和洗选业 | mining | 2000-2023 | | oil_gas_extraction | 石油和天然气开采业 | mining | 2000-2023 | | ferrous_metal_mining | 黑色金属矿采选业 | mining | 2000-2023 | | nonferrous_metal_mining | 有色金属矿采选业 | mining | 2000-2023 | | nonmetal_mining | 非金属矿采选业 | mining | 2000-2023 | | mining_support | 开采专业及辅助性活动 | mining | 2012-2023 | | other_mining | 其他采矿业 | mining | 2000-2023 | | manufacturing | 制造业 | industry | 2000-2023 | | agri_food_processing | 农副食品加工业 | manufacturing | 2000-2023 | | food_manufacturing | 食品制造业 | manufacturing | 2000-2023 | | beverage_tea | 酒、饮料和精制茶制造业 | manufacturing | 2000-2023 | | tobacco | 烟草制品业 | manufacturing | 2000-2023 | | textile | 纺织业 | manufacturing | 2000-2023 | | textile_apparel | 纺织服装、服饰业 | manufacturing | 2000-2023 | | leather_footwear | 皮革、毛皮、羽毛及其制品和制鞋业 | manufacturing | 2000-2023 | | wood_products | 木材加工及木、竹、藤、棕、草制品业 | manufacturing | 2000-2023 | | furniture | 家具制造业 | manufacturing | 2000-2023 | | paper | 造纸及纸制品业 | manufacturing | 2000-2023 | | printing | 印刷和记录媒介复制业 | manufacturing | 2000-2023 | | culture_sports_goods | 文教、工美、体育和娱乐用品制造业 | manufacturing | 2000-2023 | | petroleum_coal_fuel_processing | 石油、煤炭及其他燃料加工业 | manufacturing | 2000-2023 | | chemicals | 化学原料及化学制品制造业 | manufacturing | 2000-2023 | | pharmaceuticals | 医药制造业 | manufacturing | 2000-2023 | | chemical_fiber | 化学纤维制造业 | manufacturing | 2000-2023 | | rubber_plastic | 橡胶和塑料制品业 | manufacturing | 2000-2023 | | rubber_products | 橡胶制品业 | rubber_plastic | 2000-2011 | | plastic_products | 塑料制品业 | rubber_plastic | 2000-2011 | | nonmetal_mineral_products | 非金属矿物制品业 | manufacturing | 2000-2023 | | ferrous_smelting | 黑色金属冶炼及压延加工业 | manufacturing | 2000-2023 | | nonferrous_smelting | 有色金属冶炼及压延加工业 | manufacturing | 2000-2023 | | metal_products | 金属制品业 | manufacturing | 2000-2023 | | general_equipment | 通用设备制造业 | manufacturing | 2000-2023 | | special_equipment | 专用设备制造业 | manufacturing | 2000-2023 | | automobile | 汽车制造业 | manufacturing | 2000-2023 | | other_transport_equipment | 铁路、船舶、航空航天和其他运输设备制造业 | manufacturing | 2012-2023 | | electrical_machinery | 电气机械及器材制造业 | manufacturing | 2000-2023 | | electronics | 计算机、通信和其他电子设备制造业 | manufacturing | 2000-2023 | | instruments | 仪器仪表制造业 | manufacturing | 2000-2023 | | other_manufacturing | 其他制造业 | manufacturing | 2000-2023 | | waste_recycling | 废弃资源综合利用业 | manufacturing | 2000-2023 | | equipment_repair | 金属制品、机械和设备修理业 | manufacturing | 2012-2023 | | utilities | 电力、热力、燃气及水生产和供应业 | industry | 2000-2023 | | power_heat_supply | 电力、热力的生产和供应业 | utilities | 2000-2023 | | gas_supply | 燃气生产和供应业 | utilities | 2000-2023 | | water_supply | 水的生产和供应业 | utilities | 2000-2023 | ## 五、使用说明 - 各品种单位不同,不能跨品种相加;要跨品种比较请用折算后的 `energy`。 - 行业有上下级:合计由各部门和居民生活组成,工业由采矿业、制造业、电力热力燃气及水生产和供应业组成,采矿业和制造业再分到各门类,用 `parent_industry_code` 找上一级。 汇总时只取同一层级,不要把上级和下级一起加。 - 子项之和与上级的差在 1% 以内的情况居多(舍入和个别口径差异),不保证严格相等;2024 年没有“批发和零售业、住宿和餐饮业”的数据,当年各部门之和比合计少约 3%。 - 数据年份不齐:2025 年只有能源合计的总量,2024 年只有能源合计的各部门,各品种的分行业数据到 2023 年。 - 行业分类有调整:开采专业及辅助性活动、铁路船舶航空航天和其他运输设备制造业、金属制品机械和设备修理业从 2012 年起才有;橡胶制品业、塑料制品业只到 2011 年,是橡胶和塑料制品业的下级,两者之和只有上级的约六成。 - 有的品种在不少行业没有数据,如原油只有 731 行(其他品种 1000 多行);没有数据的行业不会出现这一行,查询时不要把缺失当作 0。 - 查询要带 `full_db_scan=True`,各年份取最新版本: ```python from bigquant import dai sql = """ SELECT report_date, energy_code, industry_code, value FROM cn_macro_energy_consumption_industry_yearly WHERE industry_code IN ('industry', 'manufacturing', 'mining') AND energy_code = 'coal' QUALIFY row_number() OVER (PARTITION BY report_date, energy_code, industry_code ORDER BY date DESC) = 1 ORDER BY report_date, industry_code """ df = dai.query(sql, full_db_scan=True).pl() ``` - 回测时取某天已经能拿到的值,不引入未来信息: ```python sql = """ SELECT report_date, energy_code, industry_code, value FROM cn_macro_energy_consumption_industry_yearly WHERE date <= '2024-06-28' AND report_date >= '2015-01-01' AND industry_code = 'industry' QUALIFY row_number() OVER (PARTITION BY report_date, energy_code, industry_code ORDER BY date DESC) = 1 ORDER BY report_date, energy_code """ df = dai.query(sql, full_db_scan=True).pl() ``` ## 六、公布时间与修订 国家统计局的数据接口不提供公布时间,公告表 `cn_macro_announcement` 里也没有这批能源数据的公告,所以 `date` 是本表自己记的版本日期。 统计局发布各指标年度数据的实际时间没有逐个核实,`date` 取偏晚的估算值,不会引入未来信息: - 上线前的历史年份:没有真实的抓取日期,按报告期末日后 330 天估算,例如 2023 年记为 2024 年 11 月 26 日。 - 本表上线以后:每天抓取最近 5 年,与各品种各行业各年份的最新版本比较,只写入新增和数值有变化的行,没有变化不写,重跑不会产生重复。 新年份的 `date` 取抓取当天与“报告期末日后 330 天”中较早的一个,所以刚发布的数据 `date` 就是抓到的当天;已入库年份的数值发生变化即视为修订,新增一行,`date` 记抓取当天,更早年份的修订通过不定期的全量历史构建补入。 上线前的历史只保留一个版本,取值是上线时的最新值。 数据源页面的更新记录里,增量和历史写入的说明是一句话:`[增量]` 或 `[历史]` 开头,写明本次写入的报告期范围和行数。 修复用于改正已入库的数据:只处理指定日期所在的年份,被改正的行沿用原来的公布日期 `date`,按主键覆盖旧值,不新增版本;更新记录里的说明是调用方传入的 `update_note` 原文。 ## 七、与旧表的关系 仓库里没有这批数据的旧表,本表是新增数据。

用例
-
表结构
字段 字段类型 字段描述
value double 全年消费总量,单位见 unit
energy_code string 能源品种代码,如 coal;energy 是折算为标准煤的能源合计
unit string value 的计量单位,每种能源品种固定一个,如万吨、亿立方米、亿千瓦小时、万吨标准煤
industry_code string 行业代码,如 manufacturing;total 是各行业和居民生活的合计
industry_name string 行业名称,国家统计局口径,合计记为“合计”
parent_industry_code string 上一级行业代码,合计没有上一级,为空;用来避免上下级重复加总
report_date timestamp[ns] 报告期,取当年 12 月 31 日,如 2023-12-31 表示 2023 年
energy_name string 能源品种名称,国家统计局口径,如“煤炭”“能源”
date timestamp[ns] 公布日期,本表首次抓到该版本数据的日期,不是统计局公告日期;上线前的历史年份按报告期末日后 330 天估算,数值被修订后新增一行

表名:cn_macro_energy_consumption_industry_yearly

起始时间:

最近更新时间: