Skip to content

Commit 9d0914f

Browse files
authored
fix transpose error message and clean up code (#2862)
1 parent 0a736de commit 9d0914f

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/abstractdataframe/reshape.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ Base.similar(v::RepeatedVector, T::Type, dims::Dims) = similar(parent(v), T, dim
542542
Base.unique(v::RepeatedVector) = unique(parent(v))
543543

544544
Base.transpose(::AbstractDataFrame, args...; kwargs...) =
545-
MethodError("`transpose` not defined for `AbstractDataFrame`s. Try `permutedims` instead")
545+
throw(ArgumentError("`transpose` not defined for `AbstractDataFrame`s. Try `permutedims` instead"))
546546

547547
"""
548548
permutedims(df::AbstractDataFrame, src_namescol::Union{Int, Symbol, AbstractString},

src/abstractdataframe/sort.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ Sort.defalg(df::AbstractDataFrame, col_ord::UserColOrdering, o::Ordering) =
325325
Sort.defalg(df, col_ord.col, o)
326326
Sort.defalg(df::AbstractDataFrame, cols, o::Ordering) = Sort.defalg(df)
327327
Sort.defalg(df::AbstractDataFrame, o::Ordering; alg=nothing, cols=[]) =
328-
alg != nothing ? alg : Sort.defalg(df, cols, o)
328+
alg !== nothing ? alg : Sort.defalg(df, cols, o)
329329

330330
########################
331331
## Actual sort functions

test/grouping.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,14 +1717,14 @@ end
17171717
@test gd[(a=:A, b=1.0)] gd[1]
17181718

17191719
@test get(gd, (a=:A, b=1), nothing) gd[1]
1720-
@test get(gd, (a=:A, b=3), nothing) == nothing
1720+
@test get(gd, (a=:A, b=3), nothing) === nothing
17211721
@test get(gd, (:A, 1), nothing) gd[1]
1722-
@test get(gd, (:A, 3), nothing) == nothing
1722+
@test get(gd, (:A, 3), nothing) === nothing
17231723
@test get(gd, first(keys(gd)), gd) gd[1]
17241724
@test get(gd, Dict("a" => :A, "b" => 1), nothing) gd[1]
17251725
@test get(gd, Dict(:a => :A, :b => 1), nothing) gd[1]
17261726
@test get(gd, Dict(:b => 1, :a => :A), nothing) gd[1]
1727-
@test get(gd, Dict(:a => :A, :b => 3), nothing) == nothing
1727+
@test get(gd, Dict(:a => :A, :b => 3), nothing) === nothing
17281728

17291729
# Wrong values
17301730
@test_throws KeyError gd[(a=:A, b=3)]

test/reshape.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ end
584584
@testset "permutedims" begin
585585
df1 = DataFrame(a=["x", "y"], b=rand(2), c=[1, 2], d=rand(Bool, 2))
586586

587-
@test_throws MethodError transpose(df1)
587+
@test_throws ArgumentError transpose(df1)
588588
@test_throws ArgumentError permutedims(df1, :bar)
589589

590590
df1_pd = permutedims(df1, 1)

0 commit comments

Comments
 (0)