Skip to content
Advertisement

Conditional formatting of arrays in Numpy Python

I am trying to make a function where if the last value of order is 1 then the code will append 1 to orders and then append the number 20 to the value array as well. If the last value is 0 in order then it will append 1 to order and append the number 15 to value.

JavaScript

Expected Output:

JavaScript

Advertisement

Answer

JavaScript

Use it like this:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement