Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6039
| From | "Dr. Wolfgang Hintze" <weh@snafu.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to combine 2 list |
| Date | 2011-10-30 09:30 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j8j5gd$f85$1@smc.vnet.net> (permalink) |
| References | <j8gnpp$5h6$1@smc.vnet.net> |
You can use Transpose[]
In[13]:=
a = {1.11, 2.07, 2.75, 3.49, 3.79, 10.2, 11.03, 19.84,
22.07, 23.29};
b = {{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}};
In[15]:=
Transpose[{b, a}]
Out[15]=
{{{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}}
--- Wolfgang
"John" <john@datasharks.biz> schrieb im Newsbeitrag
news:j8gnpp$5h6$1@smc.vnet.net...
>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.
>
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to combine 2 list John <john@datasharks.biz> - 2011-10-29 11:24 +0000 Re: How to combine 2 list "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-10-30 09:25 +0000 Re: How to combine 2 list "Dr. Wolfgang Hintze" <weh@snafu.de> - 2011-10-30 09:30 +0000 Re: How to combine 2 list Armand Tamzarian <mike.honeychurch@gmail.com> - 2011-10-30 09:33 +0000 Re: How to combine 2 list JasonE <ebaughjason@gmail.com> - 2011-11-03 08:53 +0000
csiph-web