https://prefect.io logo
a

Alberto de Santos

10/23/2020, 9:30 AM
I am wondering how to make a
map
over a
DataFrame
, do you have any idea? I see very clear how to make it over a
list
. To my mind, it seems straightforward to convert the
DataFrame
into a
list
. So, I would like to know your opinion.
a

ale

10/23/2020, 10:54 AM
Hi @Alberto de Santos, can you give us a little more context about what you want to do?
s

Scott Asher

10/23/2020, 1:07 PM
What do you mean by “make a `map`over a `DataFrame`”? There is a function
DataFrame.applymap
which applies a function to every element in a
DataFrame
if that helps?
upvote 1
e

emre

10/23/2020, 1:20 PM
If you mean spawning a mapped task for each
DataFrame
row, your upstream task can return a list of rows, and you can map over that:
return list(df.iterrows())
upvote 2
🎉 1
a

Alberto de Santos

10/23/2020, 8:29 PM
This is exactly what I wanted
iterrows()
I am aware that
DataFrame
has an
apply
method, but not usable from a
Task
perspective.
3 Views