[julia-users] Re: Graph package

2015-04-03 Thread pgs
Thanks

On Thursday, April 2, 2015 at 10:48:53 AM UTC+1, pip7...@gmail.com wrote:
>
> Hi
> How can I save the following example plot(g)  to  .gif / .png or .jpg file
>
> julia> using Graphs
>
> julia> g = simple_graph(3)
> Directed Graph (3 vertices, 0 edges)
>
> julia> add_edge!(g, 1, 2)
> edge [1]: 1 -- 2
>
> julia> add_edge!(g, 3, 2)
> edge [2]: 3 -- 2
>
> julia> add_edge!(g, 3, 1)
> edge [3]: 3 -- 1
>
> julia> plot(g)
>
>
> Regards
>
>
>

[julia-users] Re: fill array

2015-03-18 Thread pgs
Hi
I guess what I'm trying to say is that if array "a" started life as 
[11,12,13,14] -  then if we use "filter(x->x<3, z)" which returns 1,2 - I 
would like 1,2 added to array a resulting in "a array" being . 
[11,12,13,14,1,2] or [1,2,11,12,13,14]
Regards

On Wednesday, March 18, 2015 at 3:05:54 PM UTC, René Donner wrote:

> I am not sure what you mean - are you expecting a different behavior than 
> this? Both z and a are containing what they should.
>
> julia> z = [1,2,3,4]
> 4-element Array{Int64,1}:
>  1
>  2
>  3
>  4
>
> julia> a = filter(x->x<3, z)
> 2-element Array{Int64,1}:
>  1
>  2
>
> julia> z
> 4-element Array{Int64,1}:
>  1
>  2
>  3
>  4
>
> julia> a
> 2-element Array{Int64,1}:
>  1
>  2
>
>
> Am Mittwoch, 18. März 2015 16:01:11 UTC+1 schrieb pip7...@gmail.com:
>>
>> One thing I forgot to ask is  what if I wan to keep the array as it 
>> is and then add to it  ...if I run a = filter(x->x<3, z) ... it overwrites 
>> the array.
>> Regards
>>
>> On Wednesday, 18 March 2015 14:04:45 UTC, pip7...@gmail.com wrote:
>>>
>>> Thanks everybody - got it!
>>> Regards
>>>
>>> On Wednesday, 18 March 2015 12:04:48 UTC, René Donner wrote:

 or simply 

   a = filter(x->x<3, z)

 Am Mittwoch, 18. März 2015 12:46:52 UTC+1 schrieb Konstantin Markov:
>
> julia> a = [i for i=filter(x->x<3,z)]
> 2-element Array{Any,1}:
>  1
>  2
>
>
> On Wednesday, March 18, 2015 at 8:31:57 PM UTC+9, pip7...@gmail.com 
> wrote:
>>
>> Hi
>> I want to fill an array based on a condition - eg
>>
>> a = []
>> z = [1,2,3,4]
>>
>> for i = 1:length(z)
>> if i > 2   
>> continue
>> end
>> end
>>
>> so, I would now like to see the values 1 & 2 in  my array "a"
>> Regards
>>
>>
>>
>>
>>

[julia-users] Re: join dataframe columns

2015-03-02 Thread pgs
Johan
Thanks for this.
I also found that I could use .* to join two columns in a DataFrame.
Using a dot star to join! -  I found surprising - but it worked.
Regards


On Sunday, March 1, 2015 at 2:50:42 PM UTC, Johan Sigfrids wrote:
>
> With a DataFrame like:
>
> df = DataFrame(Name = ["Test", "Test2"], Name2 = ["A", "B"], Amt=[123,456])
>
> you could do something like this:
>
> df[:Name] = map((x,y) -> string(x, -, y), df[:Name], df[:Name2])
>
> Note that you will still have the Name2 column.
>
> On Sunday, March 1, 2015 at 12:35:01 AM UTC+2, pip7...@gmail.com wrote:
>>
>> Hi
>> How can I join 2 columns in a dataframe.
>>
>> e.g.
>> Dataframe 1
>>
>> RowName   Name2   Amt
>> 1 TestA   123
>> 2 Test2  B456
>> etc
>>
>> I want to be able to join Name and Name2 and use a separator like -
>> eg
>> RowName   Amt
>> 1 Test-A 123
>> 2 Test2-B456
>>
>> Regards
>>
>

[julia-users] Re: Using a function on a group of data

2015-02-25 Thread pgs
Hi
Thanks for the links.
Regards

On Tuesday, February 24, 2015 at 11:47:34 AM UTC, pgs wrote:
>
> Hi
> I have a txt file which I'm trying to perform a compuation(FUNCTION) on 
> groups of data - the Grouping being Col1 then Col2.
> eg
>
> Say my txt file has the following
>
> Col1,Col2,Col3 Col4
> A 15:00 4  8
> A 15:00 6  5
> A 15:30 2  4
> A 15:30 8  7
> B 12:00 5  2
> B 12:00 4 1
> B 18:00 2 6
> B 18:00 1 7
> B 18:00 4 0.5  etc etc
>
> myfunction = map((x,y) -> x / y * 2, Col3,Col4) 
> I then want to sum the results of my computation using the function e g
>
> So, when applying "myfunction"? - the result set is...
> A 15:00 1
> A 15:00 2.4
> sum 3.4
> A 15:30 1
> A 15:30 2.28
> sum 3.28
> So, the end game for me is just to see the final "sum" as an output - eg
> A 15:00 3.4
> A 15:30 3.28
> etc
> is this possible?
>
> Regards
>
>

[julia-users] Using a function on a group of data

2015-02-24 Thread pgs
Hi
I have a txt file which I'm trying to perform a compuation(FUNCTION) on 
groups of data - the Grouping being Col1 then Col2.
eg

Say my txt file has the following

Col1,Col2,Col3 Col4
A 15:00 4  8
A 15:00 6  5
A 15:30 2  4
A 15:30 8  7
B 12:00 5  2
B 12:00 4 1
B 18:00 2 6
B 18:00 1 7
B 18:00 4 0.5  etc etc

myfunction = map((x,y) -> x / y * 2, Col3,Col4) 
I then want to sum the results of my computation using the function e g

So, when applying "myfunction"? - the result set is...
A 15:00 1
A 15:00 2.4
sum 3.4
A 15:30 1
A 15:30 2.28
sum 3.28
So, the end game for me is just to see the final "sum" as an output - eg
A 15:00 3.4
A 15:30 3.28
etc
is this possible?

Regards



[julia-users] Re: Grouping - Dataframes

2015-02-22 Thread pgs
Hi
This now works - by *(df,:Col1,x->sum(x[:Col2])) - it was my fault as I 
left out a " in one of the headers in my txt file.*
*Thanks*


On Sunday, February 22, 2015 at 8:06:59 PM UTC, pgs wrote:

> Hi
> Is it possible to summarize data in a data frame eg
>
> Col1  Col2
> A 2
> A 2.5
> B 7
> B 2
>
> I would like sum Col2 grouping by Col1 - output would be
> A , 4.5
> B,9
>
>
> Regards
>
>
>

[julia-users] Re: Grouping - Dataframes

2015-02-22 Thread pgs
Added the by and now getting ...
'by' has no method matching by(::Array(Any,2), ::Symbol, ::Function in 
include at boot.jl:245


On Sunday, February 22, 2015 at 8:06:59 PM UTC, Philip Sivyer wrote:

> Hi
> Is it possible to summarize data in a data frame eg
>
> Col1  Col2
> A 2
> A 2.5
> B 7
> B 2
>
> I would like sum Col2 grouping by Col1 - output would be
> A , 4.5
> B,9
>
>
> Regards
>
>
>