MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How to combine 2 list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122493] Re: How to combine 2 list
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Sun, 30 Oct 2011 04:21:21 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110291113.HAA05419@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

c = {1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84, 22.07, 23.29};
d = {{2011, 8, 31}, {2011, 9, 2}, {2011, 9, 6}, {2011, 9, 20}, {2011,
     9, 21}, {2011, 9, 22}, {2011, 9, 28}, {2011, 9, 30}, {2011, 10,
     4}, {2011, 10, 10}};

Thread[{d, c}]

{{{2011, 8, 31}, 1.11}, {{2011, 9, 2}, 2.07}, {{2011, 9, 6},
   2.75}, {{2011, 9, 20}, 3.49}, {{2011, 9, 21}, 3.79}, {{2011, 9, 22},
    10.2}, {{2011, 9, 28}, 11.03}, {{2011, 9, 30},
   19.84}, {{2011, 10, 4}, 22.07}, {{2011, 10, 10}, 23.29}}

or

Transpose@{d, c}

{{{2011, 8, 31}, 1.11}, {{2011, 9, 2}, 2.07}, {{2011, 9, 6},
   2.75}, {{2011, 9, 20}, 3.49}, {{2011, 9, 21}, 3.79}, {{2011, 9, 22},
    10.2}, {{2011, 9, 28}, 11.03}, {{2011, 9, 30},
   19.84}, {{2011, 10, 4}, 22.07}, {{2011, 10, 10}, 23.29}}

Bobby

On Sat, 29 Oct 2011 06:13:12 -0500, John <john at datasharks.biz> wrote:

> I have tried to find the answer on this, I am sure it has been asked  
> before. Can anyone help?
>
> I have 2 list:
>
> cumlativeNetProfitLoss = Drop[FoldList[Plus, 0, listNetProfitLoss], 1]
>
> {1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84, 22.07, 23.29}
>
> and
>
> dateList = Reverse[dateNetProfitLoss[[All, 1]]]
> {{2011, 8, 31}, {2011, 9, 2}, {2011, 9, 6}, {2011, 9, 20}, {2011, 9,  
> 21}, {2011, 9, 22}, {2011, 9, 28}, {2011, 9, 30}, {2011, 10, 4}, {2011,  
> 10, 10}}
>
>
>
> How to I get:
>
> {{{2011, 8, 31}, 1.11}, {{2011, 9, 2}, 2.07}, {{2011, 9, 6}, 2.75},  
> {{2011, 9, 20}, 3.49}, {{2011, 9, 21}, 3.79}, {{2011, 9, 22}, 10.2},  
> {{2011, 9, 28}, 11.03}, {{2011, 9, 30}, 19.84}, {{2011, 10, 4}, 22.07},  
> {{2011, 10, 10}, 23.29}}
>
>
> Thanks in advance.
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: Re: Problem with Solve and NSolve
  • Next by Date: Re: How to combine 2 list
  • Previous by thread: Re: How to combine 2 list
  • Next by thread: Re: How to combine 2 list