Skip to content

Commit

Permalink
FEAT-#7331: Initial Polars API (#7332)
Browse files Browse the repository at this point in the history
* FEAT-#7331: Initial Polars API

This commit adds a polars namespace to Modin, and the DataFrame and
Series objects and their respective APIs. This doesn't include error
handling and is still missing several polars features:

* LazyFrame
* Expressions
* String, Temporal, Struct, and other Series accessors
* Several parameters
* Operators that we don't have query compiler methods for
   * e.g. sin, cos, tan, etc.

Those will be handled in a future PR.

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Lint

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* flake8

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* isort

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* headers

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* forgot one

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Add test

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* header

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* isort

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Add to CI

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* fix name

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Update modin/polars/base.py

Co-authored-by: Mahesh Vashishtha <mahesh.vashishtha@snowflake.com>

* address comments

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* polars 1

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Update for polars 1.x and fix some hacks

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Remove hax

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Black

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Address comments

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Lint

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

* Address comment

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>

---------

Signed-off-by: Devin Petersohn <devin.petersohn@snowflake.com>
Co-authored-by: Devin Petersohn <devin.petersohn@snowflake.com>
Co-authored-by: Mahesh Vashishtha <mahesh.vashishtha@snowflake.com>
  • Loading branch information
3 people authored Jul 24, 2024
1 parent f5f9ae9 commit 7c1dde0
Show file tree
Hide file tree
Showing 9 changed files with 4,579 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ jobs:
if: matrix.engine == 'python' || matrix.test_task == 'group_4'
- run: python -m pytest modin/tests/interchange/dataframe_protocol/pandas/test_protocol.py
if: matrix.engine == 'python' || matrix.test_task == 'group_4'
- run: python -m pytest modin/tests/polars/test_dataframe.py
- run: |
python -m pip install lazy_import
python -m pytest modin/tests/pandas/integrations/
Expand Down
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,3 +70,4 @@ dependencies:
- git+https://github.com/modin-project/modin-spreadsheet.git@49ffd89f683f54c311867d602c55443fb11bf2a5
# The `numpydoc` version should match the version installed in the `lint-pydocstyle` job of the CI.
- numpydoc==1.6.0
- polars
17 changes: 17 additions & 0 deletions modin/polars/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software distributed under
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
# ANY KIND, either express or implied. See the License for the specific language
# governing permissions and limitations under the License.

from modin.polars.dataframe import DataFrame
from modin.polars.series import Series

__all__ = ["DataFrame", "Series"]
Loading

0 comments on commit 7c1dde0

Please sign in to comment.