Skip to content

Commit

Permalink
fix: Use correct type for pyarrow.csv.read_csv
Browse files Browse the repository at this point in the history
Resolves:
```py
File ../altair/.venv/Lib/site-packages/pyarrow/csv.pyx:1258, in pyarrow._csv.read_csv()
TypeError: Cannot convert dict to pyarrow._csv.ParseOptions
```
  • Loading branch information
dangotbanned committed Jan 30, 2025
1 parent 1628cbd commit cbd04e3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion altair/datasets/_readimpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def pa_any() -> Sequence[Read[pa.Table]]:
return (
read(csv.read_csv, is_csv),
_pa_read_json_impl(),
read(csv.read_csv, is_tsv, parse_options={"delimiter": "\t"}),
read(csv.read_csv, is_tsv, parse_options=csv.ParseOptions(delimiter="\t")), # pyright: ignore[reportCallIssue]
read(feather.read_table, is_arrow),
read(parquet.read_table, is_parquet),
)
Expand Down
6 changes: 6 additions & 0 deletions tests/test_datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ def test_spatial(backend: _Backend, name: Dataset) -> None:
load(name)


@backends
def test_tsv(backend: _Backend) -> None:
load = Loader.from_backend(backend)
is_frame_backend(load("unemployment", ".tsv"), backend)


@datasets_all
@datasets_debug
def test_all_datasets(polars_loader: PolarsLoader, name: Dataset) -> None:
Expand Down

0 comments on commit cbd04e3

Please sign in to comment.