Skip to content

Commit

Permalink
Import narwhals' stable v1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
stanmart committed Sep 30, 2024
1 parent 267c321 commit c53d490
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tabmat/categorical_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def matvec(mat, vec):
import warnings
from typing import Optional, Union

import narwhals as nw
import narwhals.stable.v1 as nw
import numpy as np
from scipy import sparse as sps

Expand Down
4 changes: 2 additions & 2 deletions src/tabmat/constructor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from collections.abc import Mapping
from typing import Any, Optional, Union

import narwhals as nw
import narwhals.stable.v1 as nw
import numpy as np
from formulaic import Formula, ModelSpec
from formulaic.materializers.types import NAAction
Expand Down Expand Up @@ -156,7 +156,7 @@ def from_df(
dense_dfidx.append(dfcolidx)
dense_tmidx.append(mxcolidx)
mxcolidx += 1
elif isinstance(coldata.dtype, nw.dtypes.NumericType):
elif coldata.dtype.is_numeric():
if (coldata != 0).mean() <= sparse_threshold:
sparse_dfidx.append(dfcolidx)
sparse_tmidx.append(mxcolidx)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_categorical_matrix.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

import narwhals as nw
import narwhals.stable.v1 as nw
import numpy as np
import pandas as pd
import polars as pl
Expand Down

0 comments on commit c53d490

Please sign in to comment.