-
Notifications
You must be signed in to change notification settings - Fork 651
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
FEAT-#5423: Add a NumPy API to Modin #5422
Merged
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
6f2a6d7
FEAT-#5423: Begin implementing NumPy API Layer
RehanSD 7a4fa99
Start
devin-petersohn 2a08cf0
Next
devin-petersohn 4b68f50
Added absolute, abs, add, all, subtract to modin.numpy
billiam-wang 0b915b4
Add changes
devin-petersohn 9c7a66b
Add shape + reshape
RehanSD 1c6d708
Added additional math functions for numpy
billiam-wang 30171d2
Add list constructor
RehanSD ab0ecdb
lint
RehanSD 25510bc
Add dimension handling
RehanSD 4ef400f
Merge remote-tracking branch 'upstream/master' into numpy/init
RehanSD 43e3bb5
Fix partial broadcasting issues
RehanSD 4301b9d
Add testing
RehanSD 5ceca02
Add tests to CI
RehanSD ff9045c
Add __array_ufunc__, __array_function__, and clean up implementation …
RehanSD 4b174de
Add where
RehanSD bd2fe98
Fix df conversion retaining index issue
RehanSD 2a87a39
Add max and min and other numpy methods to namespace
RehanSD d513b03
Fix dtype handling
RehanSD d8d0d10
Fix keepdims
RehanSD 7404cb3
Fix out and add
RehanSD 0d3be93
Add support for where kwarg
RehanSD 508ecb3
Fix lint
RehanSD 90aaed7
Get tests to run
RehanSD 88aa6b5
Add testing for array ufunc
RehanSD e0fb8ce
Add testing for array function
RehanSD db3db83
Add testing for where
RehanSD f176ac8
Add tests for everything but prod, mean, min, max, and sum
RehanSD c0a1ecc
Add tests
RehanSD e706796
Bypass overflow dtype issues
RehanSD 23fe0c4
Cast to output dtype
RehanSD 22b01e0
Fix lint
RehanSD 52f0928
Add defensive dimension check
RehanSD cfaa066
Fix auto-cast issue
RehanSD f9be32d
Fix CI bug
RehanSD 48967d8
Address review comments
RehanSD 5b1da61
Fix type computation and add check for where
RehanSD 74ed3a2
Fix auto broadcast of out variable
RehanSD 3244b79
Address review comments (break up testing into multiple files, and fi…
RehanSD a3d57fe
Fix naming
RehanSD 18588b8
Add to_numpy
RehanSD 19acf64
Add warning about numpy api and fix lint
RehanSD 1bf6c00
Fix lint
RehanSD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
# 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 .arr import array | ||
|
||
from .array_creation import ( | ||
zeros_like, | ||
ones_like, | ||
) | ||
|
||
from .array_shaping import ( | ||
ravel, | ||
shape, | ||
transpose, | ||
) | ||
|
||
from .math import ( | ||
absolute, | ||
abs, | ||
add, | ||
divide, | ||
float_power, | ||
floor_divide, | ||
power, | ||
prod, | ||
multiply, | ||
remainder, | ||
mod, | ||
subtract, | ||
sum, | ||
true_divide, | ||
mean, | ||
maximum, | ||
amax, | ||
max, | ||
minimum, | ||
amin, | ||
min, | ||
) | ||
|
||
from .constants import ( | ||
Inf, | ||
Infinity, | ||
NAN, | ||
NINF, | ||
NZERO, | ||
NaN, | ||
PINF, | ||
PZERO, | ||
e, | ||
euler_gamma, | ||
inf, | ||
infty, | ||
nan, | ||
newaxis, | ||
pi, | ||
) | ||
|
||
|
||
def where(condition, x=None, y=None): | ||
if condition is True: | ||
return x | ||
if condition is False: | ||
return y | ||
if hasattr(condition, "where"): | ||
return condition.where(x=x, y=y) | ||
raise NotImplementedError( | ||
f"np.where for condition of type {type(condition)} is not yet supported in Modin." | ||
) | ||
|
||
|
||
__all__ = [ # noqa: F405 | ||
"array", | ||
"zeros_like", | ||
"ones_like", | ||
"ravel", | ||
"shape", | ||
"transpose", | ||
"absolute", | ||
"abs", | ||
"add", | ||
"divide", | ||
"float_power", | ||
"floor_divide", | ||
"power", | ||
"prod", | ||
"multiply", | ||
"remainder", | ||
"mod", | ||
"subtract", | ||
"sum", | ||
"true_divide", | ||
"mean", | ||
"maximum", | ||
"amax", | ||
"max", | ||
"minimum", | ||
"amin", | ||
"min", | ||
"where", | ||
"Inf", | ||
"Infinity", | ||
"NAN", | ||
"NINF", | ||
"NZERO", | ||
"NaN", | ||
"PINF", | ||
"PZERO", | ||
"e", | ||
"euler_gamma", | ||
"inf", | ||
"infty", | ||
"nan", | ||
"newaxis", | ||
"pi", | ||
] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires changes in https://modin.readthedocs.io/en/stable/flow/modin/config.html?