1
$\begingroup$

I can't figure out how to replace a part of a quantity array. I have:

executionList // Dimensions
{65, 7}

where each row is a QuantityArray:

executionList[[1]]
    QuantityArray[
StructuredArray`StructuredData[{
  7}, {{"EQR", 10000, 56.79706947887168, 1, "Buy", 176, "MOO"}, {
   "DimensionlessUnit", "USDollars", "USDollars", "DimensionlessUnit",
     "DimensionlessUnit", "DimensionlessUnit", 
    "DimensionlessUnit"}, {{1}}}]]

I want to replace the sixth "column" of this array (which is dimensionless), with a list of integers of length 65:

TransactionQty
{176, -346, -171, 510, 164, 162, 164, 161, -984, -157, -152, 624, \
149, 146, -590, 286, -284, -140, -140, 562, 141, -418, -134, -135, \
-127, -123, -123, -121, 1022, 125, 125, 130, 133, 129, 123, 122, 136, \
132, -1449, -151, 505, 175, 170, 159, 179, 190, 194, 191, -1625, \
-186, -184, -178, 930, 183, 185, -775, 425, 199, 165, -754, -162, \
487, -295, 284, 135}

The obvious attempt fails:

executionList[[All, 6]] = TransactionQty
Set::partd: Part specification executionList[[All,6]] is longer than depth of object.

I have tried ReplacePart, Riffle, Table,...but I cant find the correct formulation!

$\endgroup$
0

1 Answer 1

1
$\begingroup$

I think the solution may be:

x = Normal[executionList];
x[[All, 6]] = TransactionQty;
executionList=QuantityArray[x];
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.