Reference 〉 Hook

saveCSV( pandas.DataFrame data, Helipad model )

Allows CSV output to be filtered immediately before saving.

Required Parameters

  • data pandas.DataFrame

    The output of the model data, including all reporters and parameters.

  • model Helipad

    The model object.

Expected Return Value pandas.DataFrame

The modified Pandas dataframe to be saved as a CSV.

Notes and Examples

  1. charwick

    Jul 25, 2021 at 5:06

    This example removes several columns from the CSV outptut.

    @heli.hook
    def saveCSV(data, model):
    	for c in data:
    		if 'urban' in c or c in ['city', 'hsum'] or 'utility' in c or 'moveRate' in c or 'Unnamed' in c:
    			del data[c]
    	return data
  2. Contribute a Note

    Your email address will not be published.

    You may use limited HTML for formatting. Please embed blocks of code in <pre><code> </code></pre> tags.

History