近所のスーパーで最近アメリカ産牛肉を頻繁に見掛けるようになったが、気になるのは、アメリカはどのくらい日本に牛肉を輸出しているのかということである。言い換えれば、日本はアメリカの牛肉輸出相手国としてどのくらいの順位に位置しているのかということである。
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('beefusa.csv',encoding='utf-8')
df.head(2)
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))
牛肉大国だとばかり思っていたアメリカは、牛肉輸入大国であるようだ。輸出額は全然大したこと無いので意外だった。牛肉より大豆の方がはるかに輸出額が大きいとは、正直言って夢にも思わなかった。とは言っても、大豆は畑の牛肉と言われているので、大豆を牛肉と捉えれば大した額になることも確かである。
b=df_countries_imports.groupby(['Partner'])['Trade Value (US$)'].aggregate(sum)
for i in range(len(b)):
b[i] = b[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"] = "20"
fig, ax = subplots(figsize=(20,12))
b.sort_values(ascending=False, inplace=False).plot(kind='barh')
rc('xtick', labelsize=15)
rc('ytick', labelsize=25)
xticks(np.arange(0,1.7e11,1e11/5),
['{}億'.format(int(x/1e7)) if x > 0 else 0 for x in np.arange(0,1.7e10,1e10/5)])
ax.legend(["輸入額"],loc='upper right', prop={'size': 26});
カナダ、オーストラリア、メキシコ、ニュージーランドが圧倒的に多い。ニカラグアとウルグアイの中南米国もランクインしている。日本が7位に入っているのは驚きである。アメリカでもkobe beefが有名なのが頷ける数字だ。
アメリカはどこに牛肉を輸出しているのか¶
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
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,12))
a.sort_values(ascending=False, inplace=False).head(15).plot(kind='barh')
rc('xtick', labelsize=25)
rc('ytick', labelsize=25)
xticks(np.arange(0,2.1e11,1e11/5),
['{}億'.format(int(x/1e7)) if x > 0 else 0 for x in np.arange(0,2.1e10,1e10/5)])
ax.legend(["輸出額"],loc='upper right', prop={'size': 26})
for i in ax.patches:
ax.text(i.get_width()+1e9,i.get_y()+.075,\
'{:}億円'.format(int(str(i.get_width())[:-8])), fontsize=20, color='k');
日本と韓国が圧倒的に多いようだ。香港、メキシコ、カナダ、台湾がその後に続いている。韓国の人口が日本の半分以下ということを考慮すれば、1人当たりでは韓国が圧倒的に米国牛を買っている。しかしながら、最大相手国である日本への輸出額が2000億円にも満たない額では話にならない。日本の米国産牛肉に対する関税が撤廃されれば、2000億円は超えるだろうが、3000億円には絶対に届かないと思われる。次に、ピボットを使って輸出入の比率を見てみる。先ず、通貨単位をドルから円に変換する
df1_countries.loc[:, ['Trade Value (US$)']]=df1_countries.loc[:, ['Trade Value (US$)']].mul(111)
report = pivot_table(df_countries.loc[df_countries['Trade Value (US$)']>1e6],
index=['Partner'],
columns='Trade Flow',
values='Trade Value (US$)',
aggfunc=sum)
#And then display the result, sorted by import value
c = report.sort_values('Exports', ascending=False).head(30)
rcParams["font.size"] = "25"
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))
c.plot(ax=ax, kind='barh',width=.8)
tight_layout()
rc('xtick', labelsize=20)
rc('ytick', labelsize=20)
xticks(np.arange(0,2.1e11,1e11/5),
['{}億'.format(int(x/1e7)) if x > 0 else 0 for x in np.arange(0,2.1e10,1e10/5)])
ax.legend(['輸出額','輸入額'],prop={'size': 30});
日本、メキシコ、カナダ、オランダ、コスタリカからは牛肉を輸入していることが見て取れる。日本とオランダに限っては輸出が圧倒的に多い。海外で和牛ブームになると、和牛価格が暴騰する危険性を孕んでいるので、和牛はあまり輸出してもらいたくないものである。