how can i make my strings mean and sum dynamically?

Since they are just strings sum, mean, which are valid Pandas function names, you can pass them as is with agg or apply. Also, you can rewrite your code so it can be a bit more readable:

# Please please do not use `dict` as a variable
for k, (col,op) in your_dict.items(): 

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top