map of course works, but it is quite verbose. I’ve been working a group of new 
julia users lately, many of them from other languages like R, Python etc., and 
they roll their eyes when something that simple takes

 

df[:x] = map(q->parse(Int64,q), df[:x])

 

It just is quite complicated for something pretty simple… Maybe there are other 
simple constructs for this?

 

Thanks,

David

 

From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On 
Behalf Of John Myles White
Sent: Wednesday, June 15, 2016 3:53 PM
To: julia-users <julia-users@googlegroups.com>
Subject: [julia-users] Re: parse.(Int64, x)

 

I would be careful combining element-wise function application with partial 
function application. Why not use map instead?

On Wednesday, June 15, 2016 at 3:47:05 PM UTC-7, David Anthoff wrote:

I just tried to use the new dot syntax for vectorising function calls in order 
to convert an array of strings into an array of Int64. For example, if this 
would work, it would be very, very handy:

 

x = [“1”, “2”, “3”]

parse.(Int64, x)

 

Right now I get an error, but I wonder whether this could be enabled somehow in 
this new framework? If this would work for all sorts of parsing, type 
conversions etc. it would just be fantastic. Especially when working DataFrames 
and one is in the first phase of cleaning up data types of columns etc. this 
would make for a very nice and short notation.

 

Thanks,

David 

 

--

David Anthoff

University of California, Berkeley

 

http://www.david-anthoff.com

 

Reply via email to