We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Symbol
@transform!
It looks like when I try to use Symbol(x) to represent a column in transform, it causes trouble, e.g.
Symbol(x)
transform
julia> @transform!(post_cycles, :residuals=:two_party_vote - Symbol("50.0%")) ERROR: MethodError: no method matching -(::Vector{Float64}, ::Symbol) Closest candidates are: -(::Array, ::SparseArrays.AbstractSparseMatrixCSC) at /usr/share/julia/stdlib/v1.7/SparseArrays/src/sparsematrix.jl:1777 -(::Array{T, N}, ::FillArrays.Zeros{V, N}) where {T, V, N} at ~/.julia/packages/FillArrays/5Arin/src/fillalgebra.jl:241 -(::ChainRulesCore.AbstractThunk, ::Any) at ~/.julia/packages/ChainRulesCore/GUvJT/src/tangent_types/thunks.jl:30 ... Stacktrace: [1] (::var"#83#84")(506::Vector{Float64}) @ Main ~/.julia/packages/DataFramesMeta/kWkhX/src/parsing.jl:272 [2] _transformation_helper(df::DataFrame, col_idx::Int64, ::Base.RefValue{Any}) @ DataFrames ~/.julia/packages/DataFrames/zqFGs/src/abstractdataframe/selection.jl:538 [3] select_transform!(::Base.RefValue{Any}, df::DataFrame, newdf::DataFrame, transformed_cols::Set{Symbol}, copycols::Bool, allow_resizing_newdf::Base.RefValue{Bool}, column_to_copy::BitVector) @ DataFrames ~/.julia/packages/DataFrames/zqFGs/src/abstractdataframe/selection.jl:764
After renaming the column and using :median, it works fine.
:median
The text was updated successfully, but these errors were encountered:
Yes. That is expected. To refer to a column programatically, you should escape with $, i.e. Symbol doesn't cut it.
$
@transform!(post_cycles, :residuals=:two_party_vote - $(Symbol("50.0%")))
but you can use strings directly here.
@transform!(post_cycles, :residuals=:two_party_vote - $"50.0%")
PS, you can also omit the parentheses if you want
@transform! post_cycles :residuals=:two_party_vote - $"50.0%"
and ensure it's row-wise
@rtransform! post_cycles :residuals=:two_party_vote - $"50.0%"
Sorry, something went wrong.
No branches or pull requests
It looks like when I try to use
Symbol(x)
to represent a column intransform
, it causes trouble, e.g.After renaming the column and using
:median
, it works fine.The text was updated successfully, but these errors were encountered: