I recently switched from using numpy ndarrayto pandas' DataFramefor my data analysis needs. I noticed that numpy functions seem to accept DataFrameobjects instead ndarraywithout any problems. However, when I try to use many of my existing functions written to work with ndarray, they often fail when performing indexing, translation, etc. operations, and I am forced to transfer the base one ndarrayusing df.values.
Is there a standard way or set of recommendations for ensuring function compatibility with DataFrame? How to execute numpy functions for both types?
source
share