Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Has the DataFrame object from pandas superceded the other alternatives for heterogeneous data types?

Before, there was larry and structured/record arrays in NumPy, but I wonder if they are used any more with any frequency given the rapid development of the pandas package. Coming from R, I would always get stuck having to unpack the record arrays to modify values from multiple columns and reassign them back into the structure but I'm so glad that pandas now allows this for its data frames. I wonder if there are any uses for which record arrays are still superior (does it have some useful methods that pandas does not have)?

like image 558
hatmatrix Avatar asked Nov 13 '12 22:11

hatmatrix


People also ask

Is DataFrame homogeneous or heterogeneous?

Python Pandas DataFrame is a heterogeneous two-dimensional object, that is, the data are of the same type within each column but it could be a different data type for each column and are implicitly or explicitly labelled with an index.

Can Pandas store heterogeneous data?

Pandas DataFrame is a 2D mutable data structure that can store heterogeneous data in tabular format (i.e. in the form of labelled rows and columns).

Can Pandas DataFrame have different data types?

A DataFrame is a 2-dimensional data structure that can store data of different types (including characters, integers, floating point values, categorical data and more) in columns.

Can a Pandas series object hold data of different types?

Pandas Series is a one-dimensional labeled array capable of holding data of any type (integer, string, float, python objects, etc.).


1 Answers

Here's a good explanation and simple comparison between pandas and numpy record arrays - Normalize/Standardize a numpy recarray

like image 142
Calvin Cheng Avatar answered Sep 24 '22 19:09

Calvin Cheng