Overview
Pandas 1.3, released on July 3, 2021, introduces PyArrow string support and improves method chaining for more fluent code.
Main Features
PyArrow strings
The new ArrowDtype backend for text columns allows using Apache Arrow strings, providing reduced memory consumption and faster string operations.
python
import pandas as pd
# Using the PyArrow backend for strings
df = pd.DataFrame({
'name': pd.array(['Alice', 'Bob', 'Charlie'], dtype='string[pyarrow]'),
'city': pd.array(['Paris', 'Lyon', 'Marseille'], dtype='string[pyarrow]'),
})
print(df.dtypes)
# name string[pyarrow]
# city string[pyarrow]
# Optimized string operations
print(df['name'].str.upper())
Method chaining
Pandas 1.3 improves chaining with DataFrame.pipe() and new default inplace=False on more methods, making chainable transformations easier.
python
import pandas as pd
df = pd.DataFrame({
'product': ['A', 'B', 'C', 'A', 'B'],
'sales': [100, 200, 150, 300, 250],
})
# Fluent transformation chaining
result = (
df
.query('sales > 100')
.groupby('product')['sales']
.sum()
.reset_index()
.rename(columns={'sales': 'total'})
)
print(result)
