Код: Выделить всё
import polars as pl
import time
import numpy as np
print(pl.__version__)
np.random.seed(0)
indices = np.arange(2_000)
columns = [f"col_{i}" for i in range(20_000)]
df_1 = pl.DataFrame({
"index": indices,
**{col: np.random.rand(len(indices)) for col in columns}
})
df_2 = pl.DataFrame({
"index": indices,
**{col: np.random.rand(len(indices)) for col in columns}
})
print("DataFrames created.")
t0 = time.time()
df_merged = df_1.join(df_2, on="index", how="left", suffix="_right")
t1 = time.time()
print(f"Time taken to merge: {t1 - t0:.2f} seconds")
Код: Выделить всё
1.30.0
DataFrames created.
Time taken to merge: 0.06 seconds
Код: Выделить всё
1.31.0
DataFrames created.
Time taken to merge: 27.68 seconds
Подробнее здесь: https://stackoverflow.com/questions/798 ... -1-30-0-to
Мобильная версия