# UndefVarError: .\* not defined when grouping with DataframesMeta

**URL:** <https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115>\
**Category:** General Usage\
**Tags:** dataframes, dataframesmeta, operator\
**Created:** [January 17, 2023, 9:23pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115 "2023-01-17T21:23:04Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.frist](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@a.frist](https://discourse.julialang.org/u/a.frist)\
**Post date:** [January 17, 2023, 9:23pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/1 "2023-01-17T21:23:04Z")

</div>

Hello all,

I ran into a problem when running a Julia script. The following code produces an error:

> UndefVarError: .\* not defined

The offending Code:

```julia
    group = groupby(my_dataframe, [:COLUMN_1, :COLUMN_2])
    better_df = @combine(group, :NEW_COLUMN = sum(:COLUMN_4 .* :COLUMN_5))

```

What I am trying to do is group by two columns and sum the product of two other columns when grouping. It is unclear to me why I get the UndefVarError. My understanding is that the .\* operator will multiply the values in the two columns row by row. Am I missing something?

---

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [January 17, 2023, 9:33pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/2 "2023-01-17T21:33:45Z")

</div>

If you write instead

```julia
better_df = @combine(group, :NEW_COLUMN = (:COLUMN_4 .* :COLUMN_5) |> sum)

```

It will work. That being said, this looks like a bug, so I would file an issue over at `DataFramesMeta`

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [January 18, 2023, 10:43am UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/3 "2023-01-18T10:43:43Z")

</div>

x-ref: [operators do not work inside function call inside macros · Issue #352 · JuliaData/DataFramesMeta.jl · GitHub](https://github.com/JuliaData/DataFramesMeta.jl/issues/352)  
This is fixed on `master` branch.

CC @pdeffebach

---

<div class="post-metadata">

**Author:** ![sylvian\_kahane](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sylvian_kahane/32/44433_2.png) [@sylvian\_kahane](https://discourse.julialang.org/u/sylvian_kahane)\
**Post date:** [January 23, 2023, 6:25pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/4 "2023-01-23T18:25:22Z")

</div>

This also does not work:

@select df :grade\_100 = :grade .∗ 10  
ERROR: UndefVarError: ∗ not defined

from “Julia Data Science” by Storopoli et al

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [January 23, 2023, 8:28pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/5 "2023-01-23T20:28:42Z")

</div>

I apologize for this,

We have a new release [out](https://discourse.julialang.org/t/release-dataframesmeta-v-0-13-0/93427) which fixes this bug.

---

<div class="post-metadata">

**Author:** ![a.frist](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@a.frist](https://discourse.julialang.org/u/a.frist)\
**Post date:** [January 28, 2023, 11:45pm UTC](https://discourse.julialang.org/t/undefvarerror-not-defined-when-grouping-with-dataframesmeta/93115/6 "2023-01-28T23:45:38Z")

</div>

This fixed the issue for now. I also confirmed the results of the calculations are accurate to 14 decimal places.
