Skip to content
New issue

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

Cannot use transform to square the values of a column #53

Closed
bsouthwood opened this issue Apr 27, 2016 · 2 comments
Closed

Cannot use transform to square the values of a column #53

bsouthwood opened this issue Apr 27, 2016 · 2 comments

Comments

@bsouthwood
Copy link

Hello I have a float column in my DataFrame and I can't use "*" to multiply 2 columns together. I can however use "+".

leg[:gi]
DataArrays.DataArray{Float64,1}:

This fails.

leg = @Transform(leg, gi_sq = :gi * :gi)
MethodError: * has no method matching *(::Array{Float64,1}, ::Array{Float64,1})

This works

leg = @Transform(leg, gi_sq = :gi + :gi)

@tshort
Copy link
Contributor

tshort commented Apr 27, 2016

I'm not at a computer to double-check, but I think you want elementwise multiplication (.*) rather than *.

Also, please quote your code that uses macros, otherwise the GitHub user named @transform will be bothered.

@ellisvalentiner
Copy link
Contributor

using Datasets
iris = datasets("datasets", "iris")
@transform(iris, sepal_length_sq = :SepalLength .* :SepalLength)

works fine. I suggest closing this issue.

@tshort tshort closed this as completed Jul 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants