Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-13 Thread Jason Solack
I know the feeling, i get around hard to remember things like this by creating a snippet for it in Sublime text... that way I at least have a place to go to find them! On Thursday, March 13, 2014 4:13:45 AM UTC-4, David van Leeuwen wrote: > > Hi, > > I've run into this and similar things many t

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-13 Thread John Myles White
There already is a string method, which does the same thing that string() does for the Array type that DataArray tries to mimic. julia> da = @data([1, 2, 3]) 3-element DataArray{Int64,1}: 1 2 3 julia> string(da) "1\n2\n3\n” In most cases, I’d advocate doing convert(Vector{UTF8String}, da), b

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-13 Thread David van Leeuwen
Hi, I've run into this and similar things many times, and somehow each time it takes me a lot of time to come up with such a solution again. Don't ask me why I can't remember this, I must be getting old. Would it make sense to define a string(da::DataArray) to do just that, within DataArra

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-12 Thread Jason Solack
that worked, thank you very much On Tuesday, March 11, 2014 9:51:49 PM UTC-4, John Myles White wrote: > > Here's one way to do that: UTF8String[string(x) for x in df[:A]] > > -- John > > On Mar 11, 2014, at 6:48 PM, Jason Solack > > wrote: > > > no, i'm sorry. I have a vector that's eltype i

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-11 Thread John Myles White
Here's one way to do that: UTF8String[string(x) for x in df[:A]] -- John On Mar 11, 2014, at 6:48 PM, Jason Solack wrote: > no, i'm sorry. I have a vector that's eltype is Float64, it has values that > i'd like to replace with the words that describe their values. right now when > assigning

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-11 Thread Jason Solack
no, i'm sorry. I have a vector that's eltype is Float64, it has values that i'd like to replace with the words that describe their values. right now when assigning them i'm getting errors since it's type is Float and it needs to be string. so i'd like to convert the first column in the datafra

Re: [julia-users] Converting a column of a DataFrame to a string

2014-03-11 Thread John Myles White
I'm not totally sure what you mean. A column of a DataFrame is a vector, so one natural way to convert the column to a string would be to join all of the entries using join: using DataFrames df = DataFrame(A = 1:10) join(df[:A], "::") Is that what you're looking for? -- John On Mar 11, 2014,

[julia-users] Converting a column of a DataFrame to a string

2014-03-11 Thread Jason Solack
So this seems like silly question, but i'm looking to convert a column in a dataframe to a string and I don't see how to do that. Any help? Thank you! Jason