, but I get key errors. Any idea what I need to do to flatten
data
?
j
John Shearer
12/14/2021, 5:59 PM
Hi @Leanna Morinishi - I think you're trying to "reduce" the data from the mapped function, right?
John Shearer
12/14/2021, 6:05 PM
I have something like
Copy code
@task
def some_task(value: int) -> int:
return value + 42
@task
def some_reduce_task(value_list: list[int]) -> int:
# intentionally very obvious reduce
sum = 0
for value in value_list:
sum = sum + value
return sum
with Flow() as flow:
some_list = [1,2,3,4,5,42]
some_task_result_list = some_task.map(some_list) # will do some_task each element of list separately
reduced_result = some_reduce_task(some_task_result_list )
upvote 1
John Shearer
12/14/2021, 6:07 PM
I'm also using dataframes, so my reduce fucntion/task is just
Bring your towel and join one of the fastest growing data communities. Welcome to our second-generation open source orchestration platform, a completely rethought approach to dataflow automation.