Inline function on transform

The issue here is unrelated to transform or DataFrames:

julia> x = ["1.1.2000", "1.2.2000"]
2-element Array{String,1}:
 "1.1.2000"
 "1.2.2000"

julia> split.(x, ".")
2-element Array{Array{SubString{String},1},1}:
 ["1", "1", "2000"]
 ["1", "2", "2000"]

julia> split.(x, ".")[2]
3-element Array{SubString{String},1}:
 "1"
 "2"
 "2000"

julia> getmonth(x) = split(x, '.')[2]
getmonth (generic function with 1 method)

julia> getmonth.(x)
2-element Array{SubString{String},1}:
 "1"
 "2"

so the getmonth function splits its single argument and then takes the second element of the result, while split.(x) splits every element in x and therefore returns an array of arrays, each of which with containing the split results. So in getmonth you are indexing into the split result, while in split.(x)[2] you’re taking the second element of an array of arrays, which in itself is an array (the results of splitting the second argument of x, so ["1", "2", "2000"] in my example).

What you therefore want is to also broadcast the selection of the second argument:

julia> getindex.(split.(x, '.'), 2)
2-element Array{SubString{String},1}:
 "1"
 "2"

Here, I’m using getindex, which is the function that [] brackets actually calls under the hood, and tell it to get the second index of each element in split.(x, '.').