Type NamedTuple has no field id

I try to run this code,

s2_obj = @from i in df_recipe begin
@let ibu_cs = (i.ibu - cs_dict["m_ibu"]) / cs_dict["sd_ibu"]
@let color_cs = (i.color - cs_dict["m_color"]) / cs_dict["sd_color"]
@select {id = i.id, ibu = ibu_cs, color = color_cs}
@collect DataFrame
end

But get this error

type NamedTuple has no field id

Stacktrace:
 [1] getproperty(::Any, ::Symbol) at ./sysimg.jl:18
 [2] (::getfield(Main, Symbol("##24#27")))(::NamedTuple{(Symbol("##t#362"), :color_cs),Tuple{NamedTuple{(:i, :ibu_cs),Tuple{NamedTuple{(: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),Tuple{DataValues.DataValue{Int64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Int64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String}}},DataValues.DataValue{Float64}}},DataValues.DataValue{Float64}}}) at ./none:0
 [3] iterate at /home/jrun/.julia/packages/QueryOperators/OFi0k/src/enumerable/enumerable_map.jl:25 [inlined]
 [4] iterate at /home/jrun/.julia/packages/Tables/8f4rT/src/iteratorwrapper.jl:38 [inlined]
 [5] buildcolumns at /home/jrun/.julia/packages/Tables/8f4rT/src/fallbacks.jl:123 [inlined]
 [6] columns at /home/jrun/.julia/packages/Tables/8f4rT/src/fallbacks.jl:149 [inlined]
 [7] columns at /home/jrun/.julia/packages/Tables/8f4rT/src/fallbacks.jl:153 [inlined]
 [8] DataFrame(::QueryOperators.EnumerableMap{Union{},QueryOperators.EnumerableMap{NamedTuple{(Symbol("##t#362"), :color_cs),Tuple{NamedTuple{(:i, :ibu_cs),Tuple{NamedTuple{(: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),Tuple{DataValues.DataValue{Int64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Int64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String}}},DataValues.DataValue{Float64}}},DataValues.DataValue{Float64}}},QueryOperators.EnumerableMap{NamedTuple{(:i, :ibu_cs),Tuple{NamedTuple{(: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),Tuple{DataValues.DataValue{Int64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Int64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String}}},DataValues.DataValue{Float64}}},QueryOperators.EnumerableIterable{NamedTuple{(: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),Tuple{DataValues.DataValue{Int64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Int64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String}}},Tables.DataValueRowIterator{NamedTuple{(: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),Tuple{DataValues.DataValue{Int64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Int64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String},DataValues.DataValue{Float64},DataValues.DataValue{Float64},DataValues.DataValue{String},DataValues.DataValue{String}}},Array{NamedTuple{(: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),Tuple{Union{Missing, Int64},Union{Missing, String},Union{Missing, String},Union{Missing, String},Union{Missing, Int64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, String},Union{Missing, String},Union{Missing, Float64},Union{Missing, Float64},Union{Missing, String},Union{Missing, String}}},1}}},getfield(Main, Symbol("##22#25"))},getfield(Main, Symbol("##23#26"))},getfield(Main, Symbol("##24#27"))}) at /home/jrun/.julia/packages/DataFrames/IKMvt/src/other/tables.jl:21
 [9] top-level scope at In[16]:1

How can I solve it.

Are you sure that df_recipe has an id column? Please post a self-contained example.

1 Like

ok, thanks. i can solve it.