Overview

NumPy 1.23, released on June 23, 2022, improves loadtxt with better performance and more flexible format handling.

Main Features

Improved loadtxt

np.loadtxt has been rewritten in C for significantly better performance and now supports more input formats.

python
import numpy as np
from io import StringIO

# loadtxt rewritten in C, much faster
data = StringIO('1,2,3\n4,5,6\n7,8,9')
arr = np.loadtxt(data, delimiter=',')
print(arr)
# [[1. 2. 3.]
#  [4. 5. 6.]
#  [7. 8. 9.]]

Ufunc improvements

Universal functions are optimized with better SIMD dispatching and improved data type handling.

python
import numpy as np

# Optimized operations
a = np.random.randn(1_000_000)
b = np.random.randn(1_000_000)

# SIMD-optimized ufuncs
c = np.add(a, b)
d = np.multiply(a, b)
print(f'Sum: {c.sum():.2f}')
print(f'Mean product: {d.mean():.4f}')

Sources