JakobGM / patito

A data modelling layer built on top of polars and pydantic
MIT License
270 stars 23 forks source link

bug: `Model.examples` returns columns in reverse order when you pass a list #18

Open ion-elgreco opened 12 months ago

ion-elgreco commented 12 months ago

When you pass a list of values, the columns are return in reversed order. However, if you pass a single value, it's in correct order. See examples below:

import patito as pt
class Test(pt.Model):
    a:str
    b:str

Test.examples({'a':'1', 'b':'2'})
shape: (1, 2) a | b -- | -- str | str "1" | "2"

This doesn't keep the order:

import patito as pt
class Test(pt.Model):
    a:str
    b:str

Test.examples({'a':['1'], 'b':['2']})
shape: (1, 2) b | a -- | -- str | str "2" | "1"