Technical Articles
Datasphere – A simple python script to clear Null values in Data Flow
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.
Thanks Pedro Cavaco .
I have one question :
I have a requirement to write the pandas script to do forward lookup. Could you please let me know if there exists any pandas DataFrame function to read table data ?
Hello Praveen,
Check if this article is helpful for your needs.
Thanks!