A Lesser-Known Feature of Apply Method In Pandas
After applying a method on a DataFrame, we often return multiple values as a tuple. This requires additional steps to project it back as separate columns.
Instead, with the result_type argument, you can control the shape and output type. As desired, the output can be either a DataFrame or a Series.
Share this post on LinkedIn: Post Link.
Find the code for my tips here: GitHub.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.