domain_to_csv#

domain_to_csv(domain, name_of_file=None, path_to_save=None, save_summary=True, return_dataframe=False)#

Export a domain object as a CSV file. All object properties will be saved as columns in the CSV file including labels and collections associated with the object. Optionally, the function can return the pandas dataframe that was saved to the CSV file.

Parameters:
domainmuspan.domain

The domain object to be exported as csv.

name_of_filestr or None, optional

The name of the saved csv file. If None, the domain’s name will be used. If the name ends with ‘.csv’, the extension will be trimmed. Default is None.

path_to_savestr or None, optional

The path to the folder where the file will be saved. If None, the current directory will be used. Default is None.

save_summarybool, optional

If True, a summary message will be printed after saving the file. Default is True.

return_dataframebool, optional

If True, the pandas.dataframe will be returned. Default is False.

Returns:
pandas.DataFrame

The dataframe that was saved to the CSV file. Only returned if return_df is True.

Raises:
ValueError

If domain is not of type muspan.domain. If path_to_save is not a string or None. If name_of_file is not a string or None.