アメリカの豚肉輸出相手国をプロットして日本が何位か調べる

その買うを、もっとハッピーに。|ハピタス

前回の輸入豚肉プロットで、日本のナンバー1豚肉供給国がアメリカであることが判明したが、アメリカがどこにどれだけ豚肉を輸出しているのかが気になるので、今度はアメリカの豚肉輸出をプロットする。

スポンサーリンク

データの下準備

先ず、このサイトから必要なデータを漁ってくる。

from pandas import *
import warnings
warnings.simplefilter('ignore', FutureWarning)
from pandas import *
import matplotlib
matplotlib.rcParams['axes.grid'] = True # show gridlines by default
%matplotlib inline

df = read_csv('porkusa.csv',encoding='utf-8')
df.head(2)
Classification Year Period Period Desc. Aggregate Level Is Leaf Code Trade Flow Code Trade Flow Reporter Code Reporter Qty Alt Qty Unit Code Alt Qty Unit Alt Qty Netweight (kg) Gross weight (kg) Trade Value (US$) CIF Trade Value (US$) FOB Trade Value (US$) Flag
0 HS 2018 201807 July 2018 6 1 1 Imports 842 United States of America NaN NaN NaN NaN 17487 NaN 45074 NaN NaN 0
1 HS 2018 201807 July 2018 6 1 1 Imports 842 United States of America NaN NaN NaN NaN 60705 NaN 969160 NaN NaN 0

2 rows × 35 columns

df=df[['Year', 'Period','Trade Flow','Reporter', 'Partner', 'Commodity','Commodity Code','Trade Value (US$)']]
df_world = df[df['Partner'] == 'World']
df_countries = df[df['Partner'] != 'World']
df_countries_imports = df_countries[df_countries['Trade Flow'] == 'Imports']
df_world_imports=df_world[df_world['Trade Flow'] == 'Imports']
df_countries_exports = df_countries[df_countries['Trade Flow'] == 'Exports']
df_world_exports=df_world[df_world['Trade Flow'] == 'Exports']
df1_countries = df_countries
print(df_world_imports['Trade Value (US$)'].aggregate(sum))
print(df_world_exports['Trade Value (US$)'].aggregate(sum))
2021593547
6030885142

アメリカは豚肉を結構輸入しているようだ。豚肉の輸出額は、大豆に比べると全然大したことがないことが分かる。

スポンサーリンク

アメリカはどこから豚肉を輸入しているのか

先ず、通貨単位をドルから円に変換する

b=df_countries_imports.groupby(['Partner'])['Trade Value (US$)'].aggregate(sum)
for i in range(len(b)):
    b[i] = b[i]*111
#b.sort_values(ascending=False)
e = b.sort_values(ascending=False)
c=[]
for i in range(len(e)):
    d = e[i]/e.sum()*100
    c.append(d)
rcParams["font.size"] = "18"
fp = FontProperties(fname='/usr/share/fonts/opentype/ipaexfont-gothic/ipaexg.ttf', size=54)
rcParams['font.family'] = fp.get_name()
rcParams["font.size"] = "25"
fig, ax = subplots(figsize=(20,15))
b.sort_values(ascending=False, inplace=False).plot(kind='barh',width=.8,color='skyblue')
rc('xtick', labelsize=25)
rc('ytick', labelsize=25)
xticks(np.arange(0,1.5e11,1e11/5),
   ['{}億'.format(int(x/1e7)) if x > 0 else 0 for x in np.arange(0,1.5e10,1e10/5)])
ax.legend(["輸入額"],loc='upper right', prop={'size': 26})
for j,i in enumerate(ax.patches):
    ax.text((i.get_width()+5e8 if int(i.get_width()) < 1e11 else i.get_width()-1.1e11),\
     i.get_y()+.19,'{:,}{:,}{:,}円 ({:.4f}%)'.format(int(str(i.get_width())[:-8]),\
       int(str(i.get_width())[-8:-4]),int(str(i.get_width())[-4:]),c[j]) \
 if int(i.get_width()) > 1e8 else '{:,}万円 ({:.4f}%)'.format(int(str(i.get_width())[:-4]),c[j]),\
            fontsize=30, color='k');

カナダ産豚肉が圧倒的に多く、輸入額の6割を占めている。2位のポーランドと3位のデンマークが意外と言えば意外である。イタリアはパルマハムだろう。

スポンサーリンク

アメリカはどこに豚肉を輸出しているのか

a=df_countries[df_countries["Trade Flow"]=='Exports'].groupby(['Partner'])['Trade Value (US$)'].aggregate(sum)
for i in range(len(a)):
    a[i] = a[i]*111    
from matplotlib.pyplot import *
from matplotlib.font_manager import FontProperties
from matplotlib import rcParams
import matplotlib.patches as mpatches
style.use('ggplot')

rcParams["font.size"] = "18"
fp = FontProperties(fname='/usr/share/fonts/opentype/ipaexfont-gothic/ipaexg.ttf', size=54)
rcParams['font.family'] = fp.get_name()
rcParams["font.size"] = "25"
fig, ax = subplots(figsize=(20,15))
a.sort_values(ascending=False, inplace=False).head(20).plot(kind='barh',width=.8,color='pink')
rc('xtick', labelsize=25)
rc('ytick', labelsize=25)
xticks(np.arange(0,1.9e11,1e11/5),
   ['{}億'.format(int(x/1e7)) if x > 0 else 0 for x in np.arange(0,1.9e10,1e10/5)])
ax.legend(["輸入額"],loc='upper right', prop={'size': 26})
for i in ax.patches:
    ax.text((i.get_width()+5e8 if int(i.get_width()) < 1e11 else i.get_width()-.61e11),\
     i.get_y()+.07,'{:,}{:,}{:,}円'.format(int(str(i.get_width())[:-8]),\
       int(str(i.get_width())[-8:-4]),int(str(i.get_width())[-4:])) \
 if int(i.get_width()) > 1e8 else '{:,}万円'.format(int(str(i.get_width())[:-4])),\
            fontsize=30, color='k');

牛肉同様日本が1位だが、2017年の中国への大豆輸出額に比べると、牛肉と豚肉を足しても屁みたいなもんだ。面白いのは、牛肉の時は日本と僅差で2位だった韓国が4位に順位を下げていることだ。やはり、韓国では牛肉の方が人気があるのだろう。日本人の場合は、牛肉より豚肉の方が馴染みが深いというのがある。というのも、プラザ合意・牛肉自由化前は、牛肉なんて滅多に食えなかったからだ。庶民はすき焼きに豚肉を代用するのが主流だった。昭和は貧しかったが、令和も貧しい時代に逆戻りの様相を呈している。

スポンサーリンク
スポンサーリンク