コード例 #1
0
    def test_gapply_python_only_udt_val(self):
        def pandasAggFunction(series):
            x = float(series.apply(lambda pt: int(pt.x) + int(pt.y)).sum())
            return PythonOnlyPoint(
                x, x)  # still deterministic, can have exact equivalence test

        dataType = PythonOnlyUDT()
        dataGen = lambda: PythonOnlyPoint(
            float(random.randrange(GapplyTests.NVALS)),
            float(random.randrange(GapplyTests.NVALS)))
        self.checkGapplyEquivalentToPandas(pandasAggFunction, dataType,
                                           dataGen)
コード例 #2
0
 def pandasAggFunction(series):
     x = float(series.apply(lambda pt: int(pt.x) + int(pt.y)).sum())
     return PythonOnlyPoint(
         x, x)  # still deterministic, can have exact equivalence test
コード例 #3
0
ファイル: test_gapply.py プロジェクト: zedwar/spark-sklearn
 def dataGen():
     return PythonOnlyPoint(float(random.randrange(GapplyTests.NVALS)),
                            float(random.randrange(GapplyTests.NVALS)))