Skip to content

accumulate csvreader input #1244

Discussion options

You must be logged in to vote

Heya,

In general, you can use the ToArray operator to create arrays of any type. This operator packages a full sequence (it must be successfully terminated) into a single array. A good practice is then to store this array in some subject with memory. E.g.:

Whenever you want to use it, get the value from it and pass it to the next operator:

Regarding the PythonTransform, this will likely change in the new future as we are working on a new Python package for Bonsai, but for now here's an example on how you could manipulate the array:

@returns(int)
def process(value):
  accumulator = 0
  for pair in value:
      accumulator += (pair.Item1 * pair.Item2)
  return accumulator

Arrays_Python.zip

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by emilyjanedennis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants