File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -1348,6 +1348,13 @@ def _apply_python_udf(
1348
1348
axis = 1 ,
1349
1349
result_type = "expand" ,
1350
1350
)
1351
+ if hopsworks_udf .output_column_names [0 ] in dataframe .columns :
1352
+ # Overwriting features so reordering dataframe to move overwritten column to the end of the dataframe
1353
+ cols = dataframe .columns .tolist ()
1354
+ cols .append (
1355
+ cols .pop (cols .index (hopsworks_udf .output_column_names [0 ]))
1356
+ )
1357
+ dataframe = dataframe [cols ]
1351
1358
else :
1352
1359
# Dynamically creating lambda function so that we do not need to loop though to extract features required for the udf.
1353
1360
# This is done because polars 'map_rows' provides rows as tuples to the udf.
@@ -1411,6 +1418,11 @@ def _apply_pandas_udf(
1411
1418
]
1412
1419
)
1413
1420
)
1421
+ if hopsworks_udf .output_column_names [0 ] in dataframe .columns :
1422
+ # Overwriting features so reordering dataframe to move overwritten column to the end of the dataframe
1423
+ cols = dataframe .columns .tolist ()
1424
+ cols .append (cols .pop (cols .index (hopsworks_udf .output_column_names [0 ])))
1425
+ dataframe = dataframe [cols ]
1414
1426
return dataframe
1415
1427
1416
1428
@staticmethod
You can’t perform that action at this time.
0 commit comments