Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
pedrocavaco
Participant
3,434
In SAP Datasphere if we need to transform null fields coming from a source, we can achieve it using the (python) script operator, for that we can use the following code:
def transform(data):

data['Field1'].fillna('value_to_replace_the_null', inplace=True)
data['Field2'].fillna('9999', inplace=True)
data['Field3'].fillna('ABC', inplace=True)
data['Field4'].fillna('XYZ', inplace=True)
data['FieldN'].fillna('1111', inplace=True)

return data


There are other ways to achieve the same result, but still this is useful if you have any connection limitations and need some ETL while your only option is to use a Data Flow:


Even though we (currently) don't have a syntax validator for the script operator, it still is a powerful tool.
3 Comments