153153
154154Construct `KeyedArray(NamedDimsArray(A,names),keys)` from a `table` matching
155155the [Tables.jl](https://github.com/JuliaData/Tables.jl) API.
156- (This which must support both `Tables.columns` and `Tables.rows`.)
156+ (It must support both `Tables.columns` and `Tables.rows`.)
157157
158158The contents of the array is taken from the column `value::Symbol` of the table.
159159Each symbol in `names` specifies a column whose unique entries
@@ -181,15 +181,15 @@ Converts at Tables.jl table to a `KeyedArray` + `NamedDimsArray` pair,
181181using column `:val` for values, and columns `:x, :y` for names & keys.
182182Optional 2nd argument applies this type to all the key-vectors.
183183"""
184- function wrapdims (table, :: Type{KT} , value:: Symbol , names:: Symbol... ; kw... ) where {KT}
184+ function wrapdims (table, KT :: Type , value:: Symbol , names:: Symbol... ; kw... )
185185 if nameouter () == false
186186 _wrap_table (KeyedArray, KT, table, value, names... ; kw... )
187187 else
188188 _wrap_table (NamedDimsArray, KT, table, value, names... ; kw... )
189189 end
190190end
191191
192- function _wrap_table (:: Type{AT} , KT, table, value:: Symbol , names:: Symbol... ; default= undef, sort:: Bool = false , kwargs... ) where {AT}
192+ function _wrap_table (AT :: Type , KT, table, value:: Symbol , names:: Symbol... ; default= undef, sort:: Bool = false , kwargs... )
193193 # get columns of the input table source
194194 cols = Tables. columns (table)
195195
@@ -205,15 +205,14 @@ function _wrap_table(::Type{AT}, KT, table, value::Symbol, names::Symbol...; def
205205
206206 # Initialize the KeyedArray
207207 sz = length .(last .(pairs))
208-
209- A = if default === undef
208+ if default === undef
210209 data = similar (vals, sz)
211210 else
212211 data = similar (vals, Union{eltype (vals), typeof (default)}, sz)
213212 fill! (data, default)
214213 end
215-
216214 A = AT (data; pairs... )
215+
217216 populate! (A, table, value; kwargs... )
218217 return A
219218end
0 commit comments