# Replace values of nested list without resorting to part assignment?

**URL:** <https://community.wolfram.com/t/replace-values-of-nested-list-without-resorting-to-part-assignment/12648>\
**Category:** Questions\
**Tags:** data-science, finance\
**Created:** [June 25, 2018, 2:06am UTC](https://community.wolfram.com/t/replace-values-of-nested-list-without-resorting-to-part-assignment/12648 "2018-06-25T02:06:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ttfreitas](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ttfreitas/32/36699_2.png) [@ttfreitas](https://community.wolfram.com/u/ttfreitas)\
**Post date:** [June 25, 2018, 2:06am UTC](https://community.wolfram.com/t/replace-values-of-nested-list-without-resorting-to-part-assignment/12648/1 "2018-06-25T02:06:46Z")

</div>

I have a nested list of financial data such as:

```
test={{{2000,1,4},-5.93336},{{2000,1,5},1.09736},{{2000,1,6},7.19}}

```

I would like to replace `[[All,2]]` with

```
Log[1+[[All,2]]/100]

```

using _ReplacePart_ instead of _part assignment_, such as

```
test[[All, 2]] = Log[1 + (test[[All, 2]])/100]

```

How can I accomplish that?

Thank you

---

<div class="post-metadata">

**Author:** ![mroge02](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/mroge02/32/28775_2.png) [@mroge02](https://community.wolfram.com/u/mroge02)\
**Post date:** [June 25, 2018, 3:32am UTC](https://community.wolfram.com/t/replace-values-of-nested-list-without-resorting-to-part-assignment/12648/2 "2018-06-25T03:32:19Z")

</div>

Not what you requested, but the same effect:

```
Thread[{test[[All, 1]], Log[1 + test[[All, 2]]/100]}]

(* {{{2000, 1, 4}, -0.0611667}, {{2000, 1, 5}, 0.0109138}, {{2000, 1, 6}, 0.0694328}} *)

```

---

<div class="post-metadata">

**Author:** ![mitch](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@mitch](https://community.wolfram.com/u/mitch)\
**Post date:** [June 25, 2018, 5:48am UTC](https://community.wolfram.com/t/replace-values-of-nested-list-without-resorting-to-part-assignment/12648/3 "2018-06-25T05:48:39Z")

</div>

If I’m not certain what your end goal is or what the values are, but with a few assumptions on my part perhaps the following is helpful. Starting with you test list, I make a dataset

```
testDS[S1] = <| DateObject[#[[1]]] -> <|"value" -> #[[2]]|> & /@ test|> // Dataset

```

where the dates are keys. Then I create a column of logs (if I’m following your request correctly)

```
testDS[S2] = testDS[S1][All, "value" /* Replace[value_ :> <|"value" -> value, "log" -> (Log[1 + value/100])|>]]

```

Now you can operate on testDS[S2] as you wish. For instance, get all the log values with their date keys

```
testDS[S2][All, "log"]

```
