Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with narwhals-based tabmat #868

Merged
merged 3 commits into from
Oct 30, 2024
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
21 changes: 21 additions & 0 deletions pixi.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/memory_profiler-0.61.0-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/linux-64/mypy-1.11.2-py312h66e93f0_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nomkl-1.0-h5ca1d4c_0.tar.bz2
Expand Down Expand Up @@ -2506,6 +2507,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/noarch/memory_profiler-0.61.0-pyhd8ed1ab_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/mypy-1.11.2-py312h024a12e_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h7bae524_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/numexpr-2.10.0-py312h8ae5369_0.conda
Expand Down Expand Up @@ -2659,6 +2661,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/msys2-conda-epoch-20160418-1.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/mypy-1.11.2-py312h4389bb4_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nest-asyncio-1.6.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nomkl-1.0-h5ca1d4c_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/numexpr-2.10.0-py312h2aa74e6_100.conda
Expand Down Expand Up @@ -2962,6 +2965,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/linux-64/markupsafe-2.1.5-py312h66e93f0_1.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/mypy-1.11.2-py312h66e93f0_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/linux-64/ncurses-6.5-he02047a_1.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nomkl-1.0-h5ca1d4c_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/linux-64/numexpr-2.10.0-py312hf412c99_100.conda
Expand Down Expand Up @@ -3113,6 +3117,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/markupsafe-2.1.5-py312h024a12e_1.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/mypy-1.11.2-py312h024a12e_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/ncurses-6.5-h7bae524_1.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/numexpr-2.10.0-py312h8ae5369_0.conda
- conda: https://conda.anaconda.org/conda-forge/osx-arm64/numpy-2.1.0-py312hb544834_0.conda
Expand Down Expand Up @@ -3235,6 +3240,7 @@ environments:
- conda: https://conda.anaconda.org/conda-forge/win-64/msys2-conda-epoch-20160418-1.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/mypy-1.11.2-py312h4389bb4_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/mypy_extensions-1.0.0-pyha770c72_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
- conda: https://conda.anaconda.org/conda-forge/noarch/nomkl-1.0-h5ca1d4c_0.tar.bz2
- conda: https://conda.anaconda.org/conda-forge/win-64/numexpr-2.10.0-py312h2aa74e6_100.conda
- conda: https://conda.anaconda.org/conda-forge/win-64/numpy-2.1.0-py312h49bc9c5_0.conda
Expand Down Expand Up @@ -17463,6 +17469,21 @@ packages:
license_family: MIT
size: 92893
timestamp: 1725069952902
- kind: conda
name: narwhals
version: 1.10.0
build: pyhd8ed1ab_0
subdir: noarch
noarch: python
url: https://conda.anaconda.org/conda-forge/noarch/narwhals-1.10.0-pyhd8ed1ab_0.conda
sha256: 607a2a8bb743e2880bb6aaebd875c7917fe2221b3aa7f50f280781cce20e92b1
md5: b3798570a6e33f06a6b752d6db20c556
depends:
- python >=3.8
license: MIT
license_family: MIT
size: 112917
timestamp: 1729515594797
- kind: conda
name: nbclassic
version: 1.1.0
Expand Down
1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ cxx-compiler = "*"
cython = "!=3.0.4"
make = "*"
mako = "*"
narwhals = ">=1.4.1"
pip = "*"
setuptools-scm = "*"
xsimd = "<11|>12.1"
Expand Down
8 changes: 5 additions & 3 deletions src/glum_benchmarks/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,14 @@ def transform_col(i: int, dtype) -> Union[pd.DataFrame, tm.CategoricalMatrix]:
+ cat_indices_in_expanded_arr,
)
elif storage == "sparse":
X = csc_matrix(pd.concat(mat_parts, axis=1))
X = csc_matrix(pd.concat(mat_parts, axis=1, ignore_index=True))
elif storage.startswith("split"):
threshold = float(storage.split("split")[1])
X = tm.from_csc(csc_matrix(pd.concat(mat_parts, axis=1)), threshold)
X = tm.from_csc(
csc_matrix(pd.concat(mat_parts, axis=1, ignore_index=True)), threshold
)
else: # Fall back to using a dense matrix.
X = pd.concat(mat_parts, axis=1)
X = pd.concat(mat_parts, axis=1, ignore_index=True)

# Step 5) Handle weights or offsets if needed.
if data_setup == "weights":
Expand Down
Loading