409 lines
15 KiB
Plaintext
409 lines
15 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 1,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"using DelimitedFiles"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 2,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"#? readdlm"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"269×117 Array{Any,2}:\n",
|
||
" \"\\ufeffProvince/States\" \"Country/Region\" … \"5/13/2020\"\n",
|
||
" \"Confirmed\" \"Globally\" 4170424 \n",
|
||
" \"Deaths\" \"Globally\" 287399 \n",
|
||
" \"Confirmed\" \"China\" 84458 \n",
|
||
" \"Confirmed\" \"Outside of China\" 4085966 \n",
|
||
" \"Deaths\" \"China\" … 4644 \n",
|
||
" \"Hubei \" \"China\" \"\" \n",
|
||
" \"Guangdong\" \"China\" \"\" \n",
|
||
" \"Henan\" \"China\" \"\" \n",
|
||
" \"Zhejiang\" \"China\" \"\" \n",
|
||
" \"Hunan\" \"China\" … \"\" \n",
|
||
" \"Anhui\" \"China\" \"\" \n",
|
||
" \"Jiangxi\" \"China\" \"\" \n",
|
||
" ⋮ ⋱ \n",
|
||
" \"Confirmed\" \"\" 163201 \n",
|
||
" \"Deaths\" \"\" 6578 \n",
|
||
" \"Confirmed\" \"\" 1780316 \n",
|
||
" \"Deaths\" \"\" … 159799 \n",
|
||
" \"Confirmed\" \"\" 110932 \n",
|
||
" \"Deaths\" \"\" 3746 \n",
|
||
" \"Confirmed\" \"\" 284270 \n",
|
||
" \"Deaths\" \"\" 9259 \n",
|
||
" \"Confirmed\" \"\" … 1781564 \n",
|
||
" \"Deaths\" \"\" 106504 \n",
|
||
" \"Confirmed\" \"\" 49429 \n",
|
||
" \"Deaths\" \"\" 1500 "
|
||
]
|
||
},
|
||
"execution_count": 3,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"coviddata = DelimitedFiles.readdlm(\"who_covid_19_sit_rep_time_series.csv\",',',header=false)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"269×2 Array{Any,2}:\n",
|
||
" \"\\ufeffProvince/States\" \"Country/Region\" \n",
|
||
" \"Confirmed\" \"Globally\" \n",
|
||
" \"Deaths\" \"Globally\" \n",
|
||
" \"Confirmed\" \"China\" \n",
|
||
" \"Confirmed\" \"Outside of China\"\n",
|
||
" \"Deaths\" \"China\" \n",
|
||
" \"Hubei \" \"China\" \n",
|
||
" \"Guangdong\" \"China\" \n",
|
||
" \"Henan\" \"China\" \n",
|
||
" \"Zhejiang\" \"China\" \n",
|
||
" \"Hunan\" \"China\" \n",
|
||
" \"Anhui\" \"China\" \n",
|
||
" \"Jiangxi\" \"China\" \n",
|
||
" ⋮ \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" \n",
|
||
" \"Confirmed\" \"\" \n",
|
||
" \"Deaths\" \"\" "
|
||
]
|
||
},
|
||
"execution_count": 4,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"first2 = coviddata[:,1:2]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"269×114 Array{Any,2}:\n",
|
||
" \"1/21/2020\" \"1/22/2020\" \"1/23/2020\" … \"5/13/2020\"\n",
|
||
" 282 314 581 4170424 \n",
|
||
" \"\" \"\" \"\" 287399 \n",
|
||
" 278 309 571 84458 \n",
|
||
" 4 5 10 4085966 \n",
|
||
" \"\" \"\" \"\" … 4644 \n",
|
||
" 258 270 375 \"\" \n",
|
||
" 14 17 26 \"\" \n",
|
||
" \"\" 1 1 \"\" \n",
|
||
" \"\" 5 5 \"\" \n",
|
||
" \"\" 1 1 … \"\" \n",
|
||
" \"\" \"\" \"\" \"\" \n",
|
||
" \"\" 1 2 \"\" \n",
|
||
" ⋮ ⋱ \n",
|
||
" \"\" \"\" \"\" 163201 \n",
|
||
" \"\" \"\" \"\" 6578 \n",
|
||
" \"\" \"\" \"\" 1780316 \n",
|
||
" \"\" \"\" \"\" … 159799 \n",
|
||
" \"\" \"\" \"\" 110932 \n",
|
||
" \"\" \"\" \"\" 3746 \n",
|
||
" \"\" \"\" \"\" 284270 \n",
|
||
" \"\" \"\" \"\" 9259 \n",
|
||
" \"\" \"\" \"\" … 1781564 \n",
|
||
" \"\" \"\" \"\" 106504 \n",
|
||
" \"\" \"\" \"\" 49429 \n",
|
||
" \"\" \"\" \"\" 1500 "
|
||
]
|
||
},
|
||
"execution_count": 5,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"restofarray = coviddata[:,4:end]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"269×116 Array{Any,2}:\n",
|
||
" \"\\ufeffProvince/States\" \"Country/Region\" … \"5/13/2020\"\n",
|
||
" \"Confirmed\" \"Globally\" 4170424 \n",
|
||
" \"Deaths\" \"Globally\" 287399 \n",
|
||
" \"Confirmed\" \"China\" 84458 \n",
|
||
" \"Confirmed\" \"Outside of China\" 4085966 \n",
|
||
" \"Deaths\" \"China\" … 4644 \n",
|
||
" \"Hubei \" \"China\" \"\" \n",
|
||
" \"Guangdong\" \"China\" \"\" \n",
|
||
" \"Henan\" \"China\" \"\" \n",
|
||
" \"Zhejiang\" \"China\" \"\" \n",
|
||
" \"Hunan\" \"China\" … \"\" \n",
|
||
" \"Anhui\" \"China\" \"\" \n",
|
||
" \"Jiangxi\" \"China\" \"\" \n",
|
||
" ⋮ ⋱ ⋮ \n",
|
||
" \"Confirmed\" \"\" 163201 \n",
|
||
" \"Deaths\" \"\" 6578 \n",
|
||
" \"Confirmed\" \"\" 1780316 \n",
|
||
" \"Deaths\" \"\" … 159799 \n",
|
||
" \"Confirmed\" \"\" 110932 \n",
|
||
" \"Deaths\" \"\" 3746 \n",
|
||
" \"Confirmed\" \"\" 284270 \n",
|
||
" \"Deaths\" \"\" 9259 \n",
|
||
" \"Confirmed\" \"\" … 1781564 \n",
|
||
" \"Deaths\" \"\" 106504 \n",
|
||
" \"Confirmed\" \"\" 49429 \n",
|
||
" \"Deaths\" \"\" 1500 "
|
||
]
|
||
},
|
||
"execution_count": 6,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"coviddata = [first2 restofarray]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"(269, 116)"
|
||
]
|
||
},
|
||
"execution_count": 7,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"size(coviddata)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 8,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"213×115 Array{Any,2}:\n",
|
||
" \"Country/Region\" \"1/21/2020\" … \"05/12/2020\" \"5/13/2020\"\n",
|
||
" \"China\" 278 84451 84458 \n",
|
||
" \"Singapore\" 0 23822 24671 \n",
|
||
" \"Japan\" 1 15874 16024 \n",
|
||
" \"Republic of Korea\" 1 10936 10962 \n",
|
||
" \"Philippines\" 0 … 11086 11350 \n",
|
||
" \"Australia\" 0 6948 6964 \n",
|
||
" \"Malaysia\" 0 6726 6742 \n",
|
||
" \"New Zealand\" 0 1147 1147 \n",
|
||
" \"Vietnam\" 0 288 288 \n",
|
||
" \"Brunei Darussalam\" 0 … 141 141 \n",
|
||
" \"Cambodia\" 0 122 122 \n",
|
||
" \"Mongolia\" 0 42 42 \n",
|
||
" ⋮ ⋱ \n",
|
||
" \"South Sudan\" 0 174 174 \n",
|
||
" \"Malawi\" 0 57 58 \n",
|
||
" \"Eritrea\" 0 39 39 \n",
|
||
" \"Angola\" 0 45 45 \n",
|
||
" \"Zimbabwe\" 0 … 36 37 \n",
|
||
" \"Botswana\" 0 24 24 \n",
|
||
" \"Burundi\" 0 19 27 \n",
|
||
" \"Gambia\" 0 22 23 \n",
|
||
" \"Namibia\" 0 16 16 \n",
|
||
" \"Seychelles\" 0 … 11 11 \n",
|
||
" \"Mauritania\" 0 8 8 \n",
|
||
" \"Comoros\" 0 11 11 "
|
||
]
|
||
},
|
||
"execution_count": 8,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"coviddatabycountry = coviddata[42:254,2:end]"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 9,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"(213, 115)"
|
||
]
|
||
},
|
||
"execution_count": 9,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"size(coviddatabycountry)\n",
|
||
"rows,cols = size(coviddatabycountry)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 10,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"Array{Any,2}"
|
||
]
|
||
},
|
||
"execution_count": 10,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"typeof(coviddatabycountry)"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 11,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"using Dates"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 12,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"2020-01-02T00:00:00"
|
||
]
|
||
},
|
||
"execution_count": 12,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"Dates.DateTime(\"1/2/2020\",\"m/d/y\")"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 13,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"covidbycountry = Array{Any}(undef,cols,rows);"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 14,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"for j = 1:cols\n",
|
||
" for i = 1:rows\n",
|
||
" covidbycountry[j,i] = coviddatabycountry[i,j]\n",
|
||
" end\n",
|
||
"end"
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 15,
|
||
"metadata": {},
|
||
"outputs": [
|
||
{
|
||
"data": {
|
||
"text/plain": [
|
||
"\"Date\""
|
||
]
|
||
},
|
||
"execution_count": 15,
|
||
"metadata": {},
|
||
"output_type": "execute_result"
|
||
}
|
||
],
|
||
"source": [
|
||
"covidbycountry[1,1] = \"Date\""
|
||
]
|
||
},
|
||
{
|
||
"cell_type": "code",
|
||
"execution_count": 16,
|
||
"metadata": {},
|
||
"outputs": [],
|
||
"source": [
|
||
"DelimitedFiles.writedlm(\"who_covid_trans.csv\",covidbycountry,',')"
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "Julia 1.2.0",
|
||
"language": "julia",
|
||
"name": "julia-1.2"
|
||
},
|
||
"language_info": {
|
||
"file_extension": ".jl",
|
||
"mimetype": "application/julia",
|
||
"name": "julia",
|
||
"version": "1.2.0"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 4
|
||
}
|