Skip to content

reading a pl.Array(pl.Float64) column back determines dtypes by first row #328

Description

@TeunHuijben

reading a pl.Array(pl.Float64) column back silently truncates fractional values to integers when the first rows happen to hold whole numbers

Reproduce by:

import polars as pl
import tracksdata as td

graph = td.graph.SQLGraph(drivername="sqlite", database=":memory:")
graph.add_node_attr_key("pos", pl.Array(pl.Float64, 2))
graph.bulk_add_nodes([{"t": 0, "pos": [50, 50]},     # whole numbers
                      {"t": 1, "pos": [1.5, 1.5]}])  # fractional

graph.node_attrs(attr_keys=["pos"])["pos"].to_list()
# -> [[50.0, 50.0], [1.0, 1.0]]     the 1.5 became 1.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions