Created
June 15, 2021 13:47
-
-
Save joaomacalos/0959a20334c74a01f4566f5ddd534a0b to your computer and use it in GitHub Desktop.
Comparison-Julia1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load required packages | |
| using CSV | |
| using DataFrames | |
| using Plots | |
| using Pipe | |
| using Dates | |
| # Read csv | |
| commodities = CSV.read("../../../Datasets/imf-commodities.csv", DataFrame); | |
| # Data-wrangling | |
| commodities = @pipe commodities |> | |
| _[4:end, [:Commodity, :PALLFNF]] |> | |
| dropmissing(_) |> | |
| transform(_, :Commodity => (x -> replace.(x, ("M" => "-"))) => :date) |> | |
| transform(_, :date => (x -> Date.(x, "y-m")) => :date) |> | |
| transform(_, :PALLFNF => (x -> parse.(Float32, x)) => :comm); | |
| first(commodities, 6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment