Skip to content

Commit ab14395

Browse files
author
Michael Abbott
committed
tweaks
1 parent a5c4021 commit ab14395

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/tables.jl

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ end
153153
154154
Construct `KeyedArray(NamedDimsArray(A,names),keys)` from a `table` matching
155155
the [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
158158
The contents of the array is taken from the column `value::Symbol` of the table.
159159
Each symbol in `names` specifies a column whose unique entries
@@ -181,15 +181,15 @@ Converts at Tables.jl table to a `KeyedArray` + `NamedDimsArray` pair,
181181
using column `:val` for values, and columns `:x, :y` for names & keys.
182182
Optional 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
190190
end
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
219218
end

0 commit comments

Comments
 (0)