Search code examples
pythonpandasdataframeimmutability

What is size-mutable as per Python's pandas DataFrame class?


What does size-mutable mean, in this context?

"Two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). Arithmetic operations align on both row and column labels. Can be thought of as a dict-like container for Series objects. The primary pandas data structure"

from: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html

I presume it means the size is mutable--the size can be changed. Is this correct?


Solution

  • You are right. Size mutable refers that elements can be appended or deleted/pop-ed from a DataFrame. On the contrary a Series is Size immutable, which means once a Series object is created operations such as appending/deleting which would change the size of the object are not allowed.