Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

@zanjibar

ひさしぶりに nysol

経済連携協定別時系列表を扱いやすい形式に、nysol で変換しました。pandas でやるのは面倒だったので、。。。

データは上記からのダウンロード(2012 から、2016まで)して、下記の nysol のスクリプトにかけてひとつにします。

注意 最後に、^M を取り除きます。取り除く方法は、vi はこれ

この種の作業は、圧倒的に、nysol が楽だと思います。

for Y in 2012 2013 2014 2015 2016
do
for M in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
do 
mcut f=Year,Region-Country,Region,Country,HS,EPA-Code,Unit1,Unit2,Quantity1-Year,Quantity2-Year,Value-Year,Value-${M}:Value,Quantity1-${M}:Quantity1,Quantity2-${M}:Quantity2 i=${Y}_EPA.csv o=${Y}_EPA_${M}.csv
done

mv ${Y}_EPA_Jan.csv ${Y}_EPA_01.csv 
mv ${Y}_EPA_Feb.csv ${Y}_EPA_02.csv 
mv ${Y}_EPA_Mar.csv ${Y}_EPA_03.csv 
mv ${Y}_EPA_Apr.csv ${Y}_EPA_04.csv 
mv ${Y}_EPA_May.csv ${Y}_EPA_05.csv 
mv ${Y}_EPA_Jun.csv ${Y}_EPA_06.csv
mv ${Y}_EPA_Jul.csv ${Y}_EPA_07.csv 
mv ${Y}_EPA_Aug.csv ${Y}_EPA_08.csv 
mv ${Y}_EPA_Sep.csv ${Y}_EPA_09.csv 
mv ${Y}_EPA_Oct.csv ${Y}_EPA_10.csv 
mv ${Y}_EPA_Nov.csv ${Y}_EPA_11.csv 
mv ${Y}_EPA_Dec.csv ${Y}_EPA_12.csv

for M in 01 02 03 04 05 06 07 08 09 10 11 12
do
msetstr a=month v=${M} i=${Y}_EPA_${M}.csv o=temp.csv 
mv temp.csv ${Y}_EPA_${M}.csv
done
mcat i=${Y}_EPA_*.csv o=all_${Y}_EPA.csv

done

mcat i=all_*_EPA.csv o=temp.csv
mcal c='mid($s{HS},1,9)' a=hs9 i=temp.csv |
mcut -r f=HS o=EPA.csv

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
0
Help us understand the problem. What are the problem?