LoginSignup
0
1

More than 5 years have passed since last update.

自動車(HS87)の貿易統計

Last updated at Posted at 2018-04-18

とりあえずの公開です。

税関別の貿易統計のデータを1988-2017分まとめてみました。
HSコードをつけていますが、上2桁87以外は、メンテナンスしていません。
sqlite3 形式のデータです。

custom_87 約300メガ

テーブル一覧

テーブル名
hs2_name HS上2桁
hs4_name HS上4桁(メンテ中)
hs6_name HS上6桁
hs9_name HS上9桁
custom_name 税関コード
country_name 国コード
custom_1988_2017_87 1988〜2017の HS87のデータ
custom_2018_87 1,2月のデータ

1500cc-3000cc の年別輸出 リーマンショックからは回復しています。

2018_04_17.png

jupyter をとりあえずはっておきます。

#!/usr/bin/env python
# -*- encoding:utf-8 -*-
import sys,os,re,json,inspect,requests,platform
import datetime
from datetime import datetime as dt

import pandas as pd
import numpy as np

import filecmp

import matplotlib
import matplotlib.pyplot as plt
plt.style.use('ggplot') 

%matplotlib inline

from IPython.display import display, HTML
# http://www.customs.go.jp/toukei/info/tsdl_e.htm

import sqlite3
import pandas.io.sql as psql
show_tables = "select tbl_name from sqlite_master where type = 'table'"
# desc 相当 "PRAGMA table_info([テーブル名])"
desc = "PRAGMA table_info([{table}])"
#sqls =  json.loads(open('json/hs_sql.json').read())
#json.dump(sqls,open('json/hs_sql.json','w'),ensure_ascii=False, indent=4, sort_keys=True)

db = 'custom_87.db'
conn = sqlite3.connect(db)


sql="""
select Year,sum(Value) as Value
from {table} 
where exp_imp={exp_imp} and
Country = {Country} and
hs6='{hs6}' 
group by Year
order by Year
"""


# 0     304     アメリカ合衆国   2682862498
# 1     601     オーストラリア   421229475
# 2     213     ドイツ   385297518
# 3     105     中華人民共和国   343141706
# 4     302     カナダ   256708223

table='custom_1988_2017_87'
exp_imp=1
Country =  304
hs6 = "870323"
df = pd.read_sql(sql.format(table=table,Country=Country,
                            exp_imp=exp_imp,hs6=hs6),conn)
df.index = df['Year']
df.plot(y=['Value'])

アメリカusa.png

オーストラリア2018.png

ドイツ2018_04_17_1.png

中国2018_04_17_2.png

カナダcanada.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1