Hi John,
Thanks for your reply, I'm getting the following:
julia> A=DataArray([1 2; 3 4])
2x2 DataArray{Int64,2}:
1 2
3 4
julia> A*.5
2x2 DataArray{Float64,2}:
0.5 1.0
1.5 2.0
julia> A/2.
2x2 DataArray{Float64,2}:
0.5 1.0
1.5 2.0
julia> A/2
InexactError()
So it converts to Float if divided by Float, but does not convert if
divided by Integer.
Best,
Bradley
On Monday, August 18, 2014 9:31:43 AM UTC-5, John Myles White wrote:
>
> Hi Bradley,
>
> Would you consider using DataArrays for this? DataFrames no longer support
> these operations, so any upgrade in your setup would turn all of this code
> into errors.
>
> All of these operations work on DataArrays already.
>
> — John
>
> On Aug 18, 2014, at 7:28 AM, Bradley Setzler <[email protected]
> <javascript:>> wrote:
>
> >
> >
> > Good morning,
> >
> > I am looking for a simple way to convert an Integer DataFrame to a Float
> DataFrame. Here is an example of the problem:
> >
> > julia> using DataFrames
> > julia> A=DataFrame([1 2; 3 4])
> > 2x2 DataFrame:
> > x1 x2
> > [1,] 1 2
> > [2,] 3 4
> >
> > With multiplication, there is no problem automatically converting to
> Float:
> >
> > julia> A*.5
> > 2x2 DataFrame:
> > x1 x2
> > [1,] 0.5 1.0
> > [2,] 1.5 2.0
> >
> > But with division, for example, the conversion fails:
> >
> > julia> A/2
> > InexactError()
> >
> > Ideally, there would be a one-line command so that we don't have to
> worry about this issue, say DataFloat() of the form:
> >
> > julia> A=DataFloat(A)
> > 2x2 DataFrame:
> > x1 x2
> > [1,] 1.0 2.0
> > [2,] 3.0 4.0
> >
> > Does something like this exist?
> >
> > Thanks,
> > Bradley
> >
>
>