Conclusion
- Most likely because the positional argument
axis=1was not set forapply. Withaxis=1, the function is applied to each row rather than each column.
cf)
=> With axis=0, the function is applied based on columns.
=> If applying apply to a pandas Series, axis should be omitted.