Skip to content Skip to sidebar Skip to footer

Spss Modeler Extension Transform - Python

I am new to SPSS modeler. I am triyng to create a simple data transformation with python on a dummy created data. The dummy data is created as exected. (see at the bottom) I try t

Solution 1:

I'd like to comment, but have not enough reputation, so I have to ask using an answer.

Are you using the correct syntax tab? Extension Transform

Since when I use it like that, I'll get what I'd expect as the output. Output data


This code should just return your dataframe and print "Hello World" into the Console Output Tab:

import spss.pyspark.runtime
from pyspark.sql.types import *

cxt = spss.pyspark.runtime.getContext() 

if  cxt.isComputeDataModelOnly():   
        _schema = cxt.getSparkInputSchema()   
        cxt.setSparkOutputSchema(_schema)
else:   
        df = cxt.getSparkInputData()
        print("Hello World")
        cxt.setSparkOutputData(df)

Solution 2:

You can also try the use the legacy mode in the same script tab. I always use the legacy mode and the code it's similar to Clementine (old version of SPSS Modeler).

Ref from IBM

Post a Comment for "Spss Modeler Extension Transform - Python"