Showing results for 
Search instead for 
Did you mean: 

Python Batch Scoring, output one column and prediction

Python Batch Scoring, output one column and prediction

We have large csv files, in the old batch scoring code there was a "Keep Columns" and in the UI there is a "Specific Features" field but I can't seem to find how to only output specific columns and the prediction.


The code below scores perfectly fine but it outputs a massive file with all the features I fed into it plus a prediction score. I only want 1 column and prediction score in the output file.


The closest thing I've found is columnNamesRemapping but the example isn't clear


Any help would be great.




import datarobot as dr


deployment_id = "deploymentidfkdsjfdksjfsd"
input_file = "input.csv"
output_file = "predicted.csv"

job = dr.BatchPredictionJob.score_to_file(

print("started scoring...", job)






2 Replies

Welcome to the DataRobot Community @mserrette. Seems you were able to get to solve your own question in the end. If you have feedack to make it easier to find that information in the docs, please let us know. We want to make it effortless for everyone to get all the answers they need to help themselves. 

Looking forward to your feedback!


Found the answer




passthrough_colums_set=['column1', 'column2'] will preserve only the columns you want.


The documentation does not make that clear that it does what specific features does in the UI or what "Keep Columns" did in the old batch file.