I created a model builder which produce a summary statistics table, and a script tool which use this table in input, and tranpose it the way I whish to display results. I then want to join the reformated table from script tool, to a layer.
The issue is that the output of the script tool is not created, and I don't understand why.
1) summary statistics table created in the model builder
id | disruptive_element | disruptive_surface |
29 | cp | 800 |
29 | rb | 500 |
29 | aut | 300 |
30 | cp | 400 |
2) transposed table, produced in the script tool
id | cp | rb | aut |
29 | 800 | 500 | 400 |
30 | 400 | 0 | 0 |
I defined the input and output parameters in the script tool properties, and wrote the script in the execution tab.
At the end of the script, there are the following lines. the csv is saved, but the table is not created in the geodatabse.
# Set local variables
out_name = "outStats.csv"
saving_path = os.path.join(homeFolder, out_name)
pivot_df.to_csv(saving_path, sep=',', index=True)
arcpy.MakeTableView_management(in_table=saving_path, out_view='viewtemp')
outTab = arcpy.TableToTable_conversion('viewtemp', defaultGDB, 'tempTable')
arcpy.SetParameter(1, outTab)
3) Join the previous table to a polygon layer, which contains the ids
this step doesn't work yet