Overview

Pandas 2.1, released on August 31, 2023, improves Copy-on-Write mode and strengthens Arrow types as the default backend.

Main Features

Improved Copy-on-Write

Copy-on-Write (CoW) mode avoids unnecessary data copies. A copy is only made when data is modified.

python
import pandas as pd

pd.set_option('mode.copy_on_write', True)

df = pd.DataFrame({'a': [1, 2, 3], 'b': [4, 5, 6]})
view = df['a']          # no copy
view.iloc[0] = 99       # copy triggered here
print(df['a'].iloc[0])  # 1 (original unchanged)

Improved Arrow backend

ArrowDtype types are better integrated, offering improved performance for strings and nullable types.

python
import pandas as pd

df = pd.DataFrame({
    'name': pd.array(['Alice', 'Bob', None],
                     dtype='string[pyarrow]'),
    'score': pd.array([95, None, 78],
                      dtype='int64[pyarrow]'),
})
print(df.dtypes)

Sources