DataFrames in Julia

It’s straightforward to select a subset of rows of a dataframe using multiple conditions:1

df[(df[:A] .< 5) .& (df[:B] .== "c"), :]

The broadcasting here is very satisfying.

It is also possible to group a dataframe by a Dates accessor.2 Here :dt refers to a dataframe column holding the datetimes:

groupby(transform(df, :dt => x->Dates.yearmonth.(x)), :dt_yearmonth)

Or, instead:

groupby(transform(df, :dt => ByRow(Dates.yearmonth)), :dt_yearmonth)

  1. https://stackoverflow.com/questions/29421092/select-subset-of-rows-of-dataframe-using-multiple-conditions ↩︎

  2. https://stackoverflow.com/questions/64922093/can-i-groupby-day-or-month-in-julia-using-dataframes ↩︎