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), but that 
method fails for Array, so it should also fail for DataArray unless we change 
Base Julia.

 — John

On Mar 13, 2014, at 1:13 AM, David van Leeuwen <david.vanleeu...@gmail.com> 
wrote:

> 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 DataArrays.jl? 
> 
> On Wednesday, March 12, 2014 6:06:59 PM UTC+1, Jason Solack wrote:
> 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 <jays...@gmail.com> 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 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 dataframe to an eltype of 
> > string so i can replace the numeric values with strings 
> > 
> > On Tuesday, March 11, 2014 9:37:56 PM UTC-4, John Myles White wrote: 
> > 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, at 6:35 PM, Jason Solack <jays...@gmail.com> wrote: 
> > 
> > > 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 
> > 
> 

Reply via email to