Skip to content

Commit

Permalink
feat: Use _pl_read_json_roundtrip instead of pl.read_json for `py…
Browse files Browse the repository at this point in the history
…arrow`

Provides better dtype inference
  • Loading branch information
dangotbanned committed Dec 2, 2024
1 parent 9330895 commit caf534d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions altair/datasets/_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,9 @@ def __init__(self, name: _PyArrow, /) -> None:
# -------------------------------------------------------
# NOTE: Prefer `polars` since it is zero-copy and fast (1)
if find_spec("polars") is not None:
import polars as pl

def pa_read_json(source: StrPath, /, **kwds) -> pa.Table:
return pl.read_json(source).to_arrow()
return _pl_read_json_roundtrip(source).to_arrow()

else:
# NOTE: Convert inline from stdlib json (2)
Expand Down

0 comments on commit caf534d

Please sign in to comment.