You can do your own vectorization:  df["B"] = map(x -> x[(end-2):end], 
df["A"])

On Saturday, February 8, 2014 10:03:11 PM UTC-5, Rick Donnelly wrote:
>
> Suppose I create a simple DataFrame with one column:
>
>     df = DataFrame(A = ["1234567890abc", "0987654321def"])
>
> I would like to create a new column that contains only the last three 
> characters of A, but cannot figure out how to access indices of A. If it 
> were a simple string (i.e., A = "1234567890abc") then it would be simple 
> (A[11:13]). But df["A", 11:13] returns an error, as does df[["A"]][11:13]. 
> What am I missing?
>
> If I was going to do this in R the code would be:
>
>     df$B <- substr(df$A, 11, 13)
>
> Any help in what is probably obvious to everyone but me would be greatly 
> appreciated.
>
>

Reply via email to