Skip to content

Correct way to reference a column name in a dataframe with Query _.b vs :b? #331

Open
@rleyvasal

Description

@rleyvasal

Looking at the Query getting started page I came across two different ways to reference column names in a data frame.

I want to know what is the correct way to reference a column in a dataframe and why there is an inconsistency in referencing column names.

_.b

using Query, DataFrames, Statistics
df = DataFrame(a=[1,1,2,3], b=[4,5,6,8])
df2 = df |>
    @groupby(_.a) |>
    @map({a=key(_), b=mean(_.b)}) |>
    @filter(_.b > 5) |>
    @orderby_descending(_.b) |>
    DataFrame

:b

df = DataFrame(a=[1,2,3], b=[4,missing,5])

q = df |> @dropna(:b) |> DataFrame

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions