@@ -4017,6 +4017,25 @@ def dot(self, other: "Series") -> "Series":
4017
4017
4018
4018
It can also be called using ``self @ other`` in Python >= 3.5.
4019
4019
4020
+ .. note:: This method is based on an expensive operation due to the nature
4021
+ of big data. Internally it needs to generate each row for each value, and
4022
+ then group twice - it is a huge operation. To prevent misusage, this method
4023
+ has the 'compute.max_rows' default limit of input length, and raises a ValueError.
4024
+
4025
+ >>> from databricks.koalas.config import option_context
4026
+ >>> with option_context(
4027
+ ... 'compute.max_rows', 1000, "compute.ops_on_diff_frames", True
4028
+ ... ): # doctest: +NORMALIZE_WHITESPACE
4029
+ ... kdf = ks.DataFrame({'a': range(1001)})
4030
+ ... kser = ks.Series([2], index=['a'])
4031
+ ... kdf.dot(kser)
4032
+ Traceback (most recent call last):
4033
+ ...
4034
+ ValueError: Current DataFrame has more then the given limit 1000 rows.
4035
+ Please set 'compute.max_rows' by using 'databricks.koalas.config.set_option'
4036
+ to retrieve to retrieve more than 1000 rows. Note that, before changing the
4037
+ 'compute.max_rows', this operation is considerably expensive.
4038
+
4020
4039
Parameters
4021
4040
----------
4022
4041
other : Series
@@ -4059,14 +4078,23 @@ def dot(self, other: "Series") -> "Series":
4059
4078
0 -4
4060
4079
1 5
4061
4080
dtype: int64
4062
-
4081
+ >>> kdf @ kser2
4082
+ 0 -4
4083
+ 1 5
4084
+ dtype: int64
4063
4085
>>> reset_option("compute.ops_on_diff_frames")
4064
4086
"""
4065
4087
if not isinstance (other , ks .Series ):
4066
4088
raise TypeError ("Unsupported type {}" .format (type (other ).__name__ ))
4067
4089
else :
4068
4090
return cast (ks .Series , other .dot (self .transpose ())).rename (None )
4069
4091
4092
+ def __matmul__ (self , other ):
4093
+ """
4094
+ Matrix multiplication using binary `@` operator in Python>=3.5.
4095
+ """
4096
+ return self .dot (other )
4097
+
4070
4098
def to_koalas (self , index_col : Optional [Union [str , List [str ]]] = None ) -> "DataFrame" :
4071
4099
"""
4072
4100
Converts the existing DataFrame into a Koalas DataFrame.
0 commit comments