Quantco / Quantco/dataframely

Sampling fails for columns of dtype `Array(List(...), ...)`

Open
#243 0 comments 2 reactions 2 assignees View on GitHub

@borchero is already working on this.

Since Feb 17, 2026.

bug
Dominant language
Python
Stars
618
Forks
21
Avg merge
14h 34m
Merged PRs (30d)
7

Description

Consider:

def test_sample_array_list(arr_size, n_samples):
    class TestSchema(dy.Schema):
        a = dy.Array(dy.List(dy.Bool()), arr_size)
    TestSchema.sample(n_samples, generator=dy.random.Generator(0))

On dataframely==2.3.1:

  • calling test_sample_array_list(2, 1)
    fails with polars.exceptions.InvalidOperationError: cannot reshape array of size 49 into shape (1, 2)
  • and calling test_sample_array_list(1, 1)
    fails with polars.exceptions.SchemaError: type Boolean is incompatible with expected type List(Boolean)

I'd expect both to pass.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.