Why Julia?

  • Julia: Developed at MIT by Prof. Alan Edelman's group
  • Released in 2012.
  • Current release: 1.4

  • Free, open source software

  • developed by world-wide community on Github
  • Over 3000 registered packages in wide range of domains

Julia

  • Modern, powerful language
  • Interactive but high performance (fast) - previously mutually exclusive
  • Syntax: similar to Python / Matlab / R
  • But carefully designed for high-performance computational science & engineering applications
  • Design means that most of Julia is written in Julia itself
  • Hence much easier to examine and modify algorithms

us_data

url = "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"
"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"
url
"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"
typeof(url)
String
*
* (generic function with 357 methods)
(1 + 2im) * (3 + im)
1 + 7im
@which (1+ 2im) * (3 + im)
*(z::Complex, w::Complex) in Base at complex.jl:277

Grab the data

download(url, "covid_data.csv")
"covid_data.csv"
readdir
readdir (generic function with 2 methods)
readdir()
234-element Array{String,1}:
 ".ipynb_checkpoints"
 "2020-05-21-Software-Engineering-Practices-Pt-1.ipynb"
 "2020-05-22-01-Decorator.ipynb"
 "2020-05-22-02-More-On-Decorators.ipynb"
 "2020-05-23-01-Read-clean-and-validate.ipynb"
 "2020-05-23-02-Distributions.ipynb"
 "2020-05-24-01-Relationships.ipynb"
 "2020-05-24-02-Multivariate-Thinking.ipynb"
 "2020-05-25-01-Preparing-the-data-for-analysis.ipynb"
 "2020-05-25-02-Exploring-the-relationship-between-gender-and-policing.ipynb"
 "2020-05-25-03-Visual-exploratory-data-analysis.ipynb"
 "2020-05-25-04-Software-Engineering-Practices-Pt-2.ipynb"
 "2020-05-26-01-Analyzing-the-effect-of-weather-on-policing.ipynb"
 ⋮
 "2020-12-28-01-Exploring-data-on-COVID-19.ipynb"
 "README.md"
 "checkpoints"
 "covid_data.csv"
 "dataset"
 "html"
 "image"
 "models"
 "my_icons"
 "spark-warehouse"
 "utils"
 "video"

Install Package

using Pkg   # built-in package manager in Julia: Pkg
Pkg.add("CSV")   # calls the `add` function from the module Pkg.  This installs a package
   Updating registry at `C:\Users\kcsgo\.julia\registries\General`

   Updating git-repo `https://github.com/JuliaRegistries/General.git`

  Resolving package versions...
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Project.toml`
 [no changes]
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Manifest.toml`
 [no changes]
Pkg.add("DataFrames")
  Resolving package versions...
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Project.toml`
 [no changes]
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Manifest.toml`
 [no changes]

Load a package

Load a package every time we run a Julia session:

using CSV, DataFrames
CSV.read("./covid_data.csv", DataFrame)

271 rows × 347 columns (omitted printing of 342 columns)

Province/State Country/Region Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing Afghanistan 33.9391 67.71 0
2 missing Albania 41.1533 20.1683 0
3 missing Algeria 28.0339 1.6596 0
4 missing Andorra 42.5063 1.5218 0
5 missing Angola -11.2027 17.8739 0
6 missing Antigua and Barbuda 17.0608 -61.7964 0
7 missing Argentina -38.4161 -63.6167 0
8 missing Armenia 40.0691 45.0382 0
9 Australian Capital Territory Australia -35.4735 149.012 0
10 New South Wales Australia -33.8688 151.209 0
11 Northern Territory Australia -12.4634 130.846 0
12 Queensland Australia -27.4698 153.025 0
13 South Australia Australia -34.9285 138.601 0
14 Tasmania Australia -42.8821 147.327 0
15 Victoria Australia -37.8136 144.963 0
16 Western Australia Australia -31.9505 115.861 0
17 missing Austria 47.5162 14.5501 0
18 missing Azerbaijan 40.1431 47.5769 0
19 missing Bahamas 25.0259 -78.0359 0
20 missing Bahrain 26.0275 50.55 0
21 missing Bangladesh 23.685 90.3563 0
22 missing Barbados 13.1939 -59.5432 0
23 missing Belarus 53.7098 27.9534 0
24 missing Belgium 50.8333 4.46994 0
25 missing Belize 17.1899 -88.4976 0
26 missing Benin 9.3077 2.3158 0
27 missing Bhutan 27.5142 90.4336 0
28 missing Bolivia -16.2902 -63.5887 0
29 missing Bosnia and Herzegovina 43.9159 17.6791 0
30 missing Botswana -22.3285 24.6849 0
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
data = CSV.read("covid_data.csv", DataFrame)
data

271 rows × 347 columns (omitted printing of 342 columns)

Province/State Country/Region Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing Afghanistan 33.9391 67.71 0
2 missing Albania 41.1533 20.1683 0
3 missing Algeria 28.0339 1.6596 0
4 missing Andorra 42.5063 1.5218 0
5 missing Angola -11.2027 17.8739 0
6 missing Antigua and Barbuda 17.0608 -61.7964 0
7 missing Argentina -38.4161 -63.6167 0
8 missing Armenia 40.0691 45.0382 0
9 Australian Capital Territory Australia -35.4735 149.012 0
10 New South Wales Australia -33.8688 151.209 0
11 Northern Territory Australia -12.4634 130.846 0
12 Queensland Australia -27.4698 153.025 0
13 South Australia Australia -34.9285 138.601 0
14 Tasmania Australia -42.8821 147.327 0
15 Victoria Australia -37.8136 144.963 0
16 Western Australia Australia -31.9505 115.861 0
17 missing Austria 47.5162 14.5501 0
18 missing Azerbaijan 40.1431 47.5769 0
19 missing Bahamas 25.0259 -78.0359 0
20 missing Bahrain 26.0275 50.55 0
21 missing Bangladesh 23.685 90.3563 0
22 missing Barbados 13.1939 -59.5432 0
23 missing Belarus 53.7098 27.9534 0
24 missing Belgium 50.8333 4.46994 0
25 missing Belize 17.1899 -88.4976 0
26 missing Benin 9.3077 2.3158 0
27 missing Bhutan 27.5142 90.4336 0
28 missing Bolivia -16.2902 -63.5887 0
29 missing Bosnia and Herzegovina 43.9159 17.6791 0
30 missing Botswana -22.3285 24.6849 0
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
typeof(data)
DataFrame

We can rename each column name.

data_2 = rename(data, 1 => "province", 2 => "country")
data_2

271 rows × 347 columns (omitted printing of 342 columns)

province country Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing Afghanistan 33.9391 67.71 0
2 missing Albania 41.1533 20.1683 0
3 missing Algeria 28.0339 1.6596 0
4 missing Andorra 42.5063 1.5218 0
5 missing Angola -11.2027 17.8739 0
6 missing Antigua and Barbuda 17.0608 -61.7964 0
7 missing Argentina -38.4161 -63.6167 0
8 missing Armenia 40.0691 45.0382 0
9 Australian Capital Territory Australia -35.4735 149.012 0
10 New South Wales Australia -33.8688 151.209 0
11 Northern Territory Australia -12.4634 130.846 0
12 Queensland Australia -27.4698 153.025 0
13 South Australia Australia -34.9285 138.601 0
14 Tasmania Australia -42.8821 147.327 0
15 Victoria Australia -37.8136 144.963 0
16 Western Australia Australia -31.9505 115.861 0
17 missing Austria 47.5162 14.5501 0
18 missing Azerbaijan 40.1431 47.5769 0
19 missing Bahamas 25.0259 -78.0359 0
20 missing Bahrain 26.0275 50.55 0
21 missing Bangladesh 23.685 90.3563 0
22 missing Barbados 13.1939 -59.5432 0
23 missing Belarus 53.7098 27.9534 0
24 missing Belgium 50.8333 4.46994 0
25 missing Belize 17.1899 -88.4976 0
26 missing Benin 9.3077 2.3158 0
27 missing Bhutan 27.5142 90.4336 0
28 missing Bolivia -16.2902 -63.5887 0
29 missing Bosnia and Herzegovina 43.9159 17.6791 0
30 missing Botswana -22.3285 24.6849 0
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
rename!(data, 1 => "province", 2 => "country")

271 rows × 347 columns (omitted printing of 342 columns)

province country Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing Afghanistan 33.9391 67.71 0
2 missing Albania 41.1533 20.1683 0
3 missing Algeria 28.0339 1.6596 0
4 missing Andorra 42.5063 1.5218 0
5 missing Angola -11.2027 17.8739 0
6 missing Antigua and Barbuda 17.0608 -61.7964 0
7 missing Argentina -38.4161 -63.6167 0
8 missing Armenia 40.0691 45.0382 0
9 Australian Capital Territory Australia -35.4735 149.012 0
10 New South Wales Australia -33.8688 151.209 0
11 Northern Territory Australia -12.4634 130.846 0
12 Queensland Australia -27.4698 153.025 0
13 South Australia Australia -34.9285 138.601 0
14 Tasmania Australia -42.8821 147.327 0
15 Victoria Australia -37.8136 144.963 0
16 Western Australia Australia -31.9505 115.861 0
17 missing Austria 47.5162 14.5501 0
18 missing Azerbaijan 40.1431 47.5769 0
19 missing Bahamas 25.0259 -78.0359 0
20 missing Bahrain 26.0275 50.55 0
21 missing Bangladesh 23.685 90.3563 0
22 missing Barbados 13.1939 -59.5432 0
23 missing Belarus 53.7098 27.9534 0
24 missing Belgium 50.8333 4.46994 0
25 missing Belize 17.1899 -88.4976 0
26 missing Benin 9.3077 2.3158 0
27 missing Bhutan 27.5142 90.4336 0
28 missing Bolivia -16.2902 -63.5887 0
29 missing Bosnia and Herzegovina 43.9159 17.6791 0
30 missing Botswana -22.3285 24.6849 0
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
data

271 rows × 347 columns (omitted printing of 342 columns)

province country Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing Afghanistan 33.9391 67.71 0
2 missing Albania 41.1533 20.1683 0
3 missing Algeria 28.0339 1.6596 0
4 missing Andorra 42.5063 1.5218 0
5 missing Angola -11.2027 17.8739 0
6 missing Antigua and Barbuda 17.0608 -61.7964 0
7 missing Argentina -38.4161 -63.6167 0
8 missing Armenia 40.0691 45.0382 0
9 Australian Capital Territory Australia -35.4735 149.012 0
10 New South Wales Australia -33.8688 151.209 0
11 Northern Territory Australia -12.4634 130.846 0
12 Queensland Australia -27.4698 153.025 0
13 South Australia Australia -34.9285 138.601 0
14 Tasmania Australia -42.8821 147.327 0
15 Victoria Australia -37.8136 144.963 0
16 Western Australia Australia -31.9505 115.861 0
17 missing Austria 47.5162 14.5501 0
18 missing Azerbaijan 40.1431 47.5769 0
19 missing Bahamas 25.0259 -78.0359 0
20 missing Bahrain 26.0275 50.55 0
21 missing Bangladesh 23.685 90.3563 0
22 missing Barbados 13.1939 -59.5432 0
23 missing Belarus 53.7098 27.9534 0
24 missing Belgium 50.8333 4.46994 0
25 missing Belize 17.1899 -88.4976 0
26 missing Benin 9.3077 2.3158 0
27 missing Bhutan 27.5142 90.4336 0
28 missing Bolivia -16.2902 -63.5887 0
29 missing Bosnia and Herzegovina 43.9159 17.6791 0
30 missing Botswana -22.3285 24.6849 0
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
?rename
search: rename rename! propertynames

rename(df::AbstractDataFrame, vals::AbstractVector{Symbol};
       makeunique::Bool=false)
rename(df::AbstractDataFrame, vals::AbstractVector{<:AbstractString};
       makeunique::Bool=false)
rename(df::AbstractDataFrame, (from => to)::Pair...)
rename(df::AbstractDataFrame, d::AbstractDict)
rename(df::AbstractDataFrame, d::AbstractVector{<:Pair})
rename(f::Function, df::AbstractDataFrame)

Create a new data frame that is a copy of df with changed column names. Each name is changed at most once. Permutation of names is allowed.

Arguments

  • df : the AbstractDataFrame; if it is a SubDataFrame then renaming is only allowed if it was created using : as a column selector.
  • d : an AbstractDict or an AbstractVector of Pairs that maps the original names or column numbers to new names
  • f : a function which for each column takes the old name as a String and returns the new name that gets converted to a Symbol
  • vals : new column names as a vector of Symbols or AbstractStrings of the same length as the number of columns in df
  • makeunique : if false (the default), an error will be raised if duplicate names are found; if true, duplicate names will be suffixed with _i (i starting at 1 for the first duplicate).

If pairs are passed to rename (as positional arguments or in a dictionary or a vector) then:

  • from value can be a Symbol, an AbstractString or an Integer;
  • to value can be a Symbol or an AbstractString.

Mixing symbols and strings in to and from is not allowed.

See also: rename!

Examples

julia> df = DataFrame(i = 1, x = 2, y = 3)
1×3 DataFrame
 Row  i      x      y
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

julia> rename(df, :i => :A, :x => :X)
1×3 DataFrame
 Row  A      X      y
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

julia> rename(df, :x => :y, :y => :x)
1×3 DataFrame
 Row  i      y      x
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

julia> rename(df, [1 => :A, 2 => :X])
1×3 DataFrame
 Row  A      X      y
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

julia> rename(df, Dict("i" => "A", "x" => "X"))
1×3 DataFrame
 Row  A      X      y
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

julia> rename(uppercase, df)
1×3 DataFrame
 Row  I      X      Y
      Int64  Int64  Int64
─────┼─────────────────────
   1      1      2      3

Interact.jl: Simple interactive visualizations

Pkg.add("Interact")
  Resolving package versions...
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Project.toml`
 [no changes]
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Manifest.toml`
 [no changes]
using Interact

Unable to load WebIO. Please make sure WebIO works for your Jupyter client. For troubleshooting, please see the WebIO/IJulia documentation.

for i in 1:10
    @show i
end
i = 1
i = 2
i = 3
i = 4
i = 5
i = 6
i = 7
i = 8
i = 9
i = 10
typeof(1:10)
UnitRange{Int64}
collect(1:10)
10-element Array{Int64,1}:
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
for i in 1:10
    println("i = ", i)
end
i = 1
i = 2
i = 3
i = 4
i = 5
i = 6
i = 7
i = 8
i = 9
i = 10
countries = data[2:5, 2]
4-element Array{String,1}:
 "Albania"
 "Algeria"
 "Andorra"
 "Angola"
countries = data[1:end, 2]
271-element Array{String,1}:
 "Afghanistan"
 "Albania"
 "Algeria"
 "Andorra"
 "Angola"
 "Antigua and Barbuda"
 "Argentina"
 "Armenia"
 "Australia"
 "Australia"
 "Australia"
 "Australia"
 "Australia"
 ⋮
 "United Kingdom"
 "United Kingdom"
 "United Kingdom"
 "Uruguay"
 "Uzbekistan"
 "Vanuatu"
 "Venezuela"
 "Vietnam"
 "West Bank and Gaza"
 "Yemen"
 "Zambia"
 "Zimbabwe"
countries = collect(data[:, 2])
271-element Array{String,1}:
 "Afghanistan"
 "Albania"
 "Algeria"
 "Andorra"
 "Angola"
 "Antigua and Barbuda"
 "Argentina"
 "Armenia"
 "Australia"
 "Australia"
 "Australia"
 "Australia"
 "Australia"
 ⋮
 "United Kingdom"
 "United Kingdom"
 "United Kingdom"
 "Uruguay"
 "Uzbekistan"
 "Vanuatu"
 "Venezuela"
 "Vietnam"
 "West Bank and Gaza"
 "Yemen"
 "Zambia"
 "Zimbabwe"
unique_countries = unique(countries)
191-element Array{String,1}:
 "Afghanistan"
 "Albania"
 "Algeria"
 "Andorra"
 "Angola"
 "Antigua and Barbuda"
 "Argentina"
 "Armenia"
 "Australia"
 "Austria"
 "Azerbaijan"
 "Bahamas"
 "Bahrain"
 ⋮
 "Ukraine"
 "United Arab Emirates"
 "United Kingdom"
 "Uruguay"
 "Uzbekistan"
 "Vanuatu"
 "Venezuela"
 "Vietnam"
 "West Bank and Gaza"
 "Yemen"
 "Zambia"
 "Zimbabwe"

Note: Julia has 1-based indexing: indices of vectors start at 1, not 0

Extract data and plot

startswith("United", "U")
true
startswith("David", "U")
false

Array comprehension:

U_countries = [startswith(country, "U") for country in countries]
271-element Array{Bool,1}:
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 ⋮
 1
 1
 1
 1
 1
 0
 0
 0
 0
 0
 0
 0
data[U_countries, :]

17 rows × 347 columns (omitted printing of 342 columns)

province country Lat Long 1/22/20
String? String Float64? Float64? Int64
1 missing US 40.0 -100.0 1
2 missing Uganda 1.37333 32.2903 0
3 missing Ukraine 48.3794 31.1656 0
4 missing United Arab Emirates 23.4241 53.8478 0
5 Anguilla United Kingdom 18.2206 -63.0686 0
6 Bermuda United Kingdom 32.3078 -64.7505 0
7 British Virgin Islands United Kingdom 18.4207 -64.64 0
8 Cayman Islands United Kingdom 19.3133 -81.2546 0
9 Channel Islands United Kingdom 49.3723 -2.3644 0
10 Falkland Islands (Malvinas) United Kingdom -51.7963 -59.5236 0
11 Gibraltar United Kingdom 36.1408 -5.3536 0
12 Isle of Man United Kingdom 54.2361 -4.5481 0
13 Montserrat United Kingdom 16.7425 -62.1874 0
14 Turks and Caicos Islands United Kingdom 21.694 -71.7979 0
15 missing United Kingdom 55.3781 -3.436 0
16 missing Uruguay -32.5228 -55.7658 0
17 missing Uzbekistan 41.3775 64.5853 0
countries .== "US"
271-element BitArray{1}:
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 ⋮
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
 0
US_row = findfirst(countries .== "US")
248
data[US_row, :]

DataFrameRow (347 columns)

province country Lat Long 1/22/20 1/23/20 1/24/20 1/25/20 1/26/20
String? String Float64? Float64? Int64 Int64 Int64 Int64 Int64
248 missing US 40.0 -100.0 1 1 2 2 5
UC_data_row = data[US_row, :]

DataFrameRow (347 columns)

province country Lat Long 1/22/20 1/23/20 1/24/20 1/25/20 1/26/20
String? String Float64? Float64? Int64 Int64 Int64 Int64 Int64
248 missing US 40.0 -100.0 1 1 2 2 5
US_data = convert(Vector, UC_data_row[5:end])
343-element Array{Int64,1}:
        1
        1
        2
        2
        5
        5
        5
        6
        6
        8
        8
        8
       11
        ⋮
 17468841
 17665284
 17853731
 18045048
 18239758
 18466484
 18665343
 18765529
 18992126
 19142603
 19309281
 19510836
Pkg.add("Plots")
  Resolving package versions...
  Installed libfdk_aac_jll ── v0.1.6+4
  Installed EarCut_jll ────── v2.1.5+1
  Installed x265_jll ──────── v3.0.0+3
  Installed Showoff ───────── v0.3.2
  Installed RecipesPipeline ─ v0.1.13
  Installed Contour ───────── v0.5.7
  Installed StaticArrays ──── v1.0.1
  Installed Plots ─────────── v1.6.12
  Installed FreeType2_jll ─── v2.10.1+5
  Installed Bzip2_jll ─────── v1.0.6+5
  Installed LAME_jll ──────── v3.100.0+3
  Installed OpenSSL_jll ───── v1.1.1+6
  Installed Grisu ─────────── v1.0.0
  Installed libass_jll ────── v0.14.0+4
  Installed libvorbis_jll ─── v1.3.6+6
  Installed LaTeXStrings ──── v1.2.0
  Installed IterTools ─────── v1.3.0
  Installed Opus_jll ──────── v1.3.1+3
  Installed Adapt ─────────── v2.3.0
  Installed LibVPX_jll ────── v1.9.0+1
  Installed GeometryTypes ─── v0.8.4
  Installed FFMPEG_jll ────── v4.3.1+4
  Installed PlotUtils ─────── v1.0.8
  Installed FFMPEG ────────── v0.4.0
  Installed Ogg_jll ───────── v1.3.4+2
  Installed RecipesBase ───── v1.1.1
  Installed Zlib_jll ──────── v1.2.11+18
  Installed GR ────────────── v0.49.1
  Installed Latexify ──────── v0.14.7
  Installed GeometryBasics ── v0.3.5
  Installed StatsBase ─────── v0.33.2
  Installed NaNMath ───────── v0.3.5
  Installed x264_jll ──────── v2020.7.14+2
  Installed FriBidi_jll ───── v1.0.5+6
  Installed PlotThemes ────── v2.0.0
  Installed StructArrays ──── v0.4.4
  Installed ColorSchemes ──── v3.10.2
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Project.toml`
  [91a5bcdd] + Plots v1.6.12
   Updating `C:\Users\kcsgo\.julia\environments\v1.4\Manifest.toml`
  [79e6a3ab] + Adapt v2.3.0
  [6e34b625] + Bzip2_jll v1.0.6+5
  [35d6a980] + ColorSchemes v3.10.2
  [d38c429a] + Contour v0.5.7
  [5ae413db] + EarCut_jll v2.1.5+1
  [c87230d0] + FFMPEG v0.4.0
  [b22a6f82] + FFMPEG_jll v4.3.1+4
  [d7e528f0] + FreeType2_jll v2.10.1+5
  [559328eb] + FriBidi_jll v1.0.5+6
  [28b8d3ca] + GR v0.49.1
  [5c1252a2] + GeometryBasics v0.3.5
  [4d00f742] + GeometryTypes v0.8.4
  [42e2da0e] + Grisu v1.0.0
  [c8e1da08] + IterTools v1.3.0
  [c1c5ebd0] + LAME_jll v3.100.0+3
  [b964fa9f] + LaTeXStrings v1.2.0
  [23fbe1c1] + Latexify v0.14.7
  [dd192d2f] + LibVPX_jll v1.9.0+1
  [77ba4419] + NaNMath v0.3.5
  [e7412a2a] + Ogg_jll v1.3.4+2
  [458c3c95] + OpenSSL_jll v1.1.1+6
  [91d4177d] + Opus_jll v1.3.1+3
  [ccf2f8ad] + PlotThemes v2.0.0
  [995b91a9] + PlotUtils v1.0.8
  [91a5bcdd] + Plots v1.6.12
  [3cdcf5f2] + RecipesBase v1.1.1
  [01d81517] + RecipesPipeline v0.1.13
  [992d4aef] + Showoff v0.3.2
  [90137ffa] + StaticArrays v1.0.1
  [2913bbd2] + StatsBase v0.33.2
  [09ab397b] + StructArrays v0.4.4
  [83775a58] + Zlib_jll v1.2.11+18
  [0ac62f75] + libass_jll v0.14.0+4
  [f638f0a6] + libfdk_aac_jll v0.1.6+4
  [f27f6e37] + libvorbis_jll v1.3.6+6
  [1270edf5] + x264_jll v2020.7.14+2
  [dfaa095f] + x265_jll v3.0.0+3
   Building GR → `C:\Users\kcsgo\.julia\packages\GR\cRdXQ\deps\build.log`
using Plots
┌ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
└ @ Base loading.jl:1260
plot(US_data)
col_names = names(data)
347-element Array{String,1}:
 "province"
 "country"
 "Lat"
 "Long"
 "1/22/20"
 "1/23/20"
 "1/24/20"
 "1/25/20"
 "1/26/20"
 "1/27/20"
 "1/28/20"
 "1/29/20"
 "1/30/20"
 ⋮
 "12/18/20"
 "12/19/20"
 "12/20/20"
 "12/21/20"
 "12/22/20"
 "12/23/20"
 "12/24/20"
 "12/25/20"
 "12/26/20"
 "12/27/20"
 "12/28/20"
 "12/29/20"
date_strings = String.(names(data))[5:end]
343-element Array{String,1}:
 "1/22/20"
 "1/23/20"
 "1/24/20"
 "1/25/20"
 "1/26/20"
 "1/27/20"
 "1/28/20"
 "1/29/20"
 "1/30/20"
 "1/31/20"
 "2/1/20"
 "2/2/20"
 "2/3/20"
 ⋮
 "12/18/20"
 "12/19/20"
 "12/20/20"
 "12/21/20"
 "12/22/20"
 "12/23/20"
 "12/24/20"
 "12/25/20"
 "12/26/20"
 "12/27/20"
 "12/28/20"
 "12/29/20"

Parse: convert string representation into a Julia object

date_strings[1]
"1/22/20"
using Dates
format = Dates.DateFormat("d/m/Y")
dateformat"d/m/Y"
parse(Date, date_strings[1], format)
ArgumentError: Month: 22 out of range (1:12)

Stacktrace:
 [1] Date(::Int64, ::Int64, ::Int64) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Dates\src\types.jl:223
 [2] parse(::Type{Date}, ::String, ::DateFormat{Symbol("d/m/Y"),Tuple{Dates.DatePart{'d'},Dates.Delim{Char,1},Dates.DatePart{'m'},Dates.Delim{Char,1},Dates.DatePart{'Y'}}}) at D:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.4\Dates\src\parse.jl:285
 [3] top-level scope at In[60]:1
format = Dates.DateFormat("m/d/Y")
parse(Date, date_strings[1], format) + Year(2000)
2020-01-22
dates = parse.(Date, date_strings, format) + Year(2000)
343-element Array{Date,1}:
 2020-01-22
 2020-01-23
 2020-01-24
 2020-01-25
 2020-01-26
 2020-01-27
 2020-01-28
 2020-01-29
 2020-01-30
 2020-01-31
 2020-02-01
 2020-02-02
 2020-02-03
 ⋮
 2020-12-18
 2020-12-19
 2020-12-20
 2020-12-21
 2020-12-22
 2020-12-23
 2020-12-24
 2020-12-25
 2020-12-26
 2020-12-27
 2020-12-28
 2020-12-29
plot(dates, US_data, xticks=dates[1:5:end], xrotation=45, leg=:topleft, 
    label="US data", m=:o)

xlabel!("date")
ylabel!("confirmed cases in US")
title!("US confirmed COVID-19 cases")
plot(dates, US_data, xticks=dates[1:5:end], xrotation=45, leg=:topleft, 
    label="US data", m=:o,
    yscale=:log10)

xlabel!("date")
ylabel!("confirmed cases in US")
title!("US confirmed COVID-19 cases")