I try to load following code
using DataFrames, Query, CSV, JLD2, StatsBase, MLLabelUtils, Random
include("chp3_functions.jl")
Random.seed!(24908)
## Types for the files columns
IntOrMiss = Union{Int64,Missing}
FltOrMiss = Union{Float64,Missing}
StrOrMiss = Union{String,Missing}
## define variable names for each column
recipe_header = ["beer_id", "name", "url", "style", "style_id", "size",
"og", "fg", "abv", "ibu", "color", "boil_size", "boil_time", "biol_grav",
"efficiency", "mash_thick", "sugar_scale", "brew_method", "pitch_rate",
"pri_temp", "prime_method", "prime_am"]
## dictionary of types for each column
recipe_types2 = Dict{String, Union}(
"beer_id" => IntOrMiss,
"name" => StrOrMiss,
"url" => StrOrMiss,
"style" => StrOrMiss,
"style_id" => IntOrMiss,
"size" => FltOrMiss,
"og" => FltOrMiss,
"fg" => FltOrMiss,
"abv" => FltOrMiss,
"ibu" => FltOrMiss,
"color" => FltOrMiss,
"boil_size" => FltOrMiss,
"boil_time" => FltOrMiss,
"biol_grav" => FltOrMiss,
"efficiency" => FltOrMiss,
"mash_thick" => FltOrMiss,
"sugar_scale" => StrOrMiss,
"brew_method" => StrOrMiss,
"pitch_rate" => FltOrMiss,
"pri_temp" => FltOrMiss,
"prime_method" => StrOrMiss,
"prime_am" => StrOrMiss
)
## read csv file
df_recipe_raw = CSV.read("recipeData.csv",
DataFrame;
delim = ',' ,
quotechar = '"',
missingstring = "N/A",
datarow = 2,
header = recipe_header,
types = recipe_types2,
allowmissing=:all
)
But get this error when i want to load this.
MethodError: no method matching read(::String, ::Type{DataFrame}; delim=',', quotechar='"', missingstring="N/A", datarow=2, header=["beer_id", "name", "url", "style", "style_id", "size", "og", "fg", "abv", "ibu" … "boil_time", "biol_grav", "efficiency", "mash_thick", "sugar_scale", "brew_method", "pitch_rate", "pri_temp", "prime_method", "prime_am"], types=Dict("pitch_rate"=>Union{Missing, Float64},"ibu"=>Union{Missing, Float64},"beer_id"=>Union{Missing, Int64},"prime_am"=>Union{Missing, String},"style"=>Union{Missing, String},"fg"=>Union{Missing, Float64},"sugar_scale"=>Union{Missing, String},"color"=>Union{Missing, Float64},"biol_grav"=>Union{Missing, Float64},"boil_time"=>Union{Missing, Float64}…), allowmissing=:all)
Closest candidates are:
read(::Any; copycols, kwargs...) at C:\Users\Satu\.julia\packages\CSV\IwqOm\src\CSV.jl:625
top-level scope at none:0