There are probably going to be quite a few changes in the DataFrames 
package when you go from Julia 0.2 to 0.3.

On Monday, August 18, 2014 7:28:48 PM UTC+3, Bradley Setzler wrote:
>
> Thanks, Johan. I have upgraded to 0.3 release candidate and see what you 
> mean about scalar multiplication not working for DataFrame any more. I see 
> also that DataArray successfully converts Integer to Float in the way John 
> was describing earlier, which solves the original problem.
>
> Problem solved, thanks guys,
> Bradley
>
>
>
> On Monday, August 18, 2014 10:32:25 AM UTC-5, Johan Sigfrids wrote:
>>
>> Multiplying a DataFrame by a scalar has been deprecated and will not work 
>> once you update to Julia 0.3 and the associated DataFrames version.
>>
>> On Monday, August 18, 2014 6:10:44 PM UTC+3, Bradley Setzler wrote:
>>>
>>> Update: I found a 1-line command to convert everything in a DataFrame 
>>> into a Float that seems to work generally:
>>>
>>> data = data*1.0
>>>
>>> So, for example,
>>> julia> A=DataFrame([1 2 ; 3 4])
>>> 2x2 DataFrame:
>>> x1 x2
>>> [1,] 1 2
>>> [2,] 3 4
>>> julia> A=A*1.0
>>> 2x2 DataFrame:
>>> x1 x2
>>> [1,] 1.0 2.0
>>> [2,] 3.0 4.0
>>>
>>> Best,
>>> Bradley
>>>
>>>
>>>
>>> On Monday, August 18, 2014 10:02:02 AM UTC-5, Bradley Setzler wrote:
>>>>
>>>> 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]> 
>>>>> 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 
>>>>> > 
>>>>>
>>>>>

Reply via email to