Skip to content

Commit 6d36cfb

Browse files
committed
Finish dealing with operators on dataframes
1 parent 8a577c9 commit 6d36cfb

File tree

3 files changed

+19
-56
lines changed

3 files changed

+19
-56
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,25 @@
1212

1313
class DataFrame:
1414
"""
15-
A DataFrame.
15+
DataFrame object
1616
17-
Notes
18-
-----
19-
Note that this DataFrame class is not meant to be instantiated directly by
17+
Note that this DataFrame object is not meant to be instantiated directly by
2018
users of the library implementing the dataframe API standard. Rather, use
2119
constructor functions or an already-created dataframe object retrieved via
2220
21+
**Python operator support**
22+
23+
All arithmetic operators defined by the Python language, except for
24+
``__matmul__``, ``__neg__`` and ``__pos__``, must be supported for
25+
numerical data types.
26+
27+
All comparison operators defined by the Python language must be supported
28+
by the dataframe object for all data types for which those comparisons are
29+
supported by the builtin scalar types corresponding to a data type.
30+
31+
In-place operators must not be supported. All operations on the dataframe
32+
object are out-of-place.
33+
2334
"""
2435
@property
2536
def dataframe(self) -> object:

spec/API_specification/dataframe_object.rst

Lines changed: 2 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -4,57 +4,8 @@ Dataframe object
44
================
55

66
A conforming implementation of the dataframe API standard must provide and
7-
support a dataframe object having the following attributes and methods.
8-
9-
Operators
10-
---------
11-
12-
A conforming implementation of the dataframe API standard must provide and
13-
support a dataframe object supporting the following Python operators.
14-
15-
Arithmetic Operators
16-
~~~~~~~~~~~~~~~~~~~~
17-
18-
A conforming implementation of the array API standard must provide and support
19-
a dataframe object supporting the following Python arithmetic operators.
20-
21-
Arithmetic operators should be defined for a dataframe having real-valued data types.
22-
23-
.. note::
24-
25-
TODO: figure out whether we want to add ``__neg__`` and ``__pos__``, those
26-
are the two missing arithmetic operators.
27-
28-
29-
Comparison Operators
30-
~~~~~~~~~~~~~~~~~~~~
31-
32-
A conforming implementation of the dataframe API standard must provide and
33-
support a dataframe object supporting the following Python comparison
34-
operators.
35-
36-
Comparison operators should be defined for dataframes having any data type.
37-
38-
In-place Operators
39-
~~~~~~~~~~~~~~~~~~
40-
41-
TODO
42-
43-
Reflected Operators
44-
~~~~~~~~~~~~~~~~~~~
45-
46-
TODO
47-
48-
Arithmetic Operators
49-
""""""""""""""""""""
50-
51-
- ``__radd__``
52-
- ``__rsub__``
53-
- ``__rmul__``
54-
- ``__rtruediv__``
55-
- ``__rfloordiv__``
56-
- ``__rpow__``
57-
- ``__rmod__``
7+
support a dataframe object having the following methods, attributes, and
8+
behavior.
589

5910
.. currentmodule:: dataframe_api
6011

spec/API_specification/groupby_object.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Groupby object
44
==============
55

66
A conforming implementation of the dataframe API standard must provide and
7-
support a groupby object having the following methods.
7+
support a groupby object with the following API:
88

99
.. currentmodule:: dataframe_api
1010

1111
.. autoclass:: GroupBy
1212

13+

0 commit comments

Comments
 (0)