I am wondering how to make a `map` over a `DataFra...
# prefect-community
a
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
Hi @Alberto de Santos, can you give us a little more context about what you want to do?
s
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
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
This is exactly what I wanted
iterrows()
I am aware that
DataFrame
has an
apply
method, but not usable from a
Task
perspective.