Question:This pandas code works fine:
ValueError: Columns must be same length as key
How to fix this? Note that I need to use apply
Answer:If you absolutely need to use
apply, you can make the return value as a series (But try to use @BENY’s answer):
If you have better answer, please add a comment about this, thank you!