Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion linopy/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,11 @@ def infer_schema_polars(ds: Dataset) -> dict[Hashable, pl.DataType]:
dict: A dictionary mapping column names to their corresponding Polars data types.
"""
schema = {}
np_major_version = int(np.__version__.split(".")[0])
use_int32 = os.name == "nt" and np_major_version < 2
for name, array in ds.items():
if np.issubdtype(array.dtype, np.integer):
schema[name] = pl.Int32 if os.name == "nt" else pl.Int64
schema[name] = pl.Int32 if use_int32 else pl.Int64
elif np.issubdtype(array.dtype, np.floating):
schema[name] = pl.Float64 # type: ignore
elif np.issubdtype(array.dtype, np.bool_):
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ classifiers = [

requires-python = ">=3.9"
dependencies = [
"numpy<2.0",
"numpy; python_version > '3.10'",
"numpy<2; python_version <= '3.10'",
"scipy",
"bottleneck",
"toolz",
Expand Down
Loading