Код: Выделить всё
# sample_paths = ['market1.fth', 'market2.fth', 'market3.fth']
query = (
pl.scan_ipc(sample_paths, memory_map=False)
.filter(some_condition)
.select(pl.col('time'), pl.col('market'), pl.col('value').do_something())
.collect()
.pivot(on='market', index='time', values='value')
)
┌─────────────────────┬───────────┬───────────┬──────┐
│ time ┆ m1 ┆ m2 ┆ m3 │
│ --- ┆ --- ┆ --- ┆ --- │
│ datetime[ms] ┆ f64 ┆ f64 ┆ f64 │
╞═════════════════════╪═══════════╪═══════════╪══════╡
│ 2023-03-10 08:00:00 ┆ 0.023035 ┆ 0.000126 ┆ null │
│ 2023-03-10 08:01:00 ┆ 0.023 ┆ 0.000126 ┆ null │
│ 2023-03-10 08:02:00 ┆ 0.023 ┆ 0.000126 ┆ null │
│ 2023-03-10 08:03:00 ┆ 0.023034 ┆ 0.0001255 ┆ null │
│ 2023-03-10 08:04:00 ┆ 0.0232051 ┆ 0.000125 ┆ null │
└─────────────────────┴───────────┴───────────┴──────┘
Подробнее здесь: https://stackoverflow.com/questions/785 ... -operation
Мобильная версия