O'Reilly logo

Hands-On Data Analysis with NumPy and pandas by Curtis Miller

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Vectorization with DataFrames

Vectorization can be applied to DataFrames. Many NumPy ufuncs, such as square root or sqrt, will work as expected when given a DataFrame; in fact, they may still return a DataFrame when given a DataFrame. That said, this cannot be guaranteed, especially when using a custom ufunc created with vectorize. They may instead return an ndarray in such a situation. While these methods work on DataFrames with common data types, it cannot be guaranteed that they will work on all DataFrames.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required