Skip to content

Instantly share code, notes, and snippets.

@joaomacalos
Created June 15, 2021 13:47
Show Gist options
  • Select an option

  • Save joaomacalos/0959a20334c74a01f4566f5ddd534a0b to your computer and use it in GitHub Desktop.

Select an option

Save joaomacalos/0959a20334c74a01f4566f5ddd534a0b to your computer and use it in GitHub Desktop.
Comparison-Julia1
# 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