Skip to content

Commit

Permalink
fix macro_cnbs
Browse files Browse the repository at this point in the history
  • Loading branch information
albertandking committed Jul 19, 2023
1 parent 4197f0b commit 1bcd4a8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
36 changes: 23 additions & 13 deletions akshare/economic/marco_cnbs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Date: 2023/7/17 21:30
Date: 2023/7/19 18:20
Desc: 国家金融与发展实验室-中国宏观杠杆率数据
http://114.115.232.154:8080/
"""
Expand All @@ -25,20 +25,30 @@ def macro_cnbs() -> pd.DataFrame:

temp_df.rename(
columns={
'Period': '年份',
'Household': '居民部门',
'Non-financial corporations': '非金融企业部门',
'Central government ': '中央政府',
'Local government': '地方政府',
'General government': '政府部门',
'Non financial sector': '实体经济部门',
'Financial sector(asset side)': '金融部门资产方',
'Financial sector(liability side)': '金融部门负债方'
"Period": "年份",
"Household": "居民部门",
"Non-financial corporations": "非金融企业部门",
"Central government ": "中央政府",
"Local government": "地方政府",
"General government": "政府部门",
"Non financial sector": "实体经济部门",
"Financial sector(asset side)": "金融部门资产方",
"Financial sector(liability side)": "金融部门负债方",
},
inplace=True)
inplace=True,
)

column_order = ['年份', '居民部门', '非金融企业部门', '政府部门', '中央政府', '地方政府', '实体经济部门',
'金融部门资产方', '金融部门负债方']
column_order = [
"年份",
"居民部门",
"非金融企业部门",
"政府部门",
"中央政府",
"地方政府",
"实体经济部门",
"金融部门资产方",
"金融部门负债方",
]
temp_df = temp_df.reindex(columns=column_order)

temp_df["居民部门"] = pd.to_numeric(temp_df["居民部门"], errors="coerce")
Expand Down
3 changes: 2 additions & 1 deletion docs/data/macro/macro.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ print(macro_cnbs_df)
数据示例

```
年份 居民部门 非金融企业部门 政府部门 中央政府 地方政府 实体经济部门 金融部门资产方 金融部门负债方
年份 居民部门 非金融企业部门 政府部门 中央政府 地方政府 实体经济部门 金融部门资产方 金融部门负债方
0 1992-12 7.5 90.0 8.3 4.4 3.9 105.8 7.8 7.2
1 1993-03 7.5 91.1 8.1 4.2 3.9 106.7 7.8 7.3
2 1993-06 7.4 91.1 8.2 4.4 3.8 106.7 7.7 7.3
Expand All @@ -56,6 +56,7 @@ print(macro_cnbs_df)
119 2022-09 62.1 160.9 49.8 20.9 28.9 272.7 49.3 63.9
120 2022-12 61.9 160.9 50.4 21.4 29.0 273.1 50.0 64.4
121 2023-03 63.3 167.0 51.5 21.4 30.1 281.8 52.7 65.6
[122 rows x 9 columns]
```

#### 国民经济运行状况
Expand Down

0 comments on commit 1bcd4a8

Please sign in to comment.