Skip to content

analysis.py

Analysis (Node)

Analysis object to interact with Celonis Studio API.

datamodel: Datamodel property readonly

Get the Datamodel connected to the Analysis.

draft: BaseDraftDocument property writable

Get/Set the Base Draft Document of the Analysis. Uses Analysis.draft.

published: BasePublishedDocument property writable

Get/Set the Base Published Document of the Analysis. Uses Analysis.published.

saved_formulas: CelonisCollection[BaseAnalysisSavedFormula] property readonly

Get all saved formulas of the Analysis. Uses Analysis.saved_formulas.

images: CelonisCollection[BaseAnalysisImage] property readonly

Get all images of the Analysis. Uses Analysis.images.

get_data_frame(self, pql_query, **kwargs)

Exports the results of a PQL query as pyarrow.parquet.ParquetFile and converts it to a pandas.DataFrame. Uses Analysis.get_data_frame.

Parameters:

Name Type Description Default
pql_query PQL

The table query to be executed.

required
kwargs

Optional keyword arguments passed to Analysis.get_data_frame

{}

Returns:

Type Description
DataFrame

Dataframe containing the results of the query.

get_data_file(self, pql_query, file_path=None, export_type='PARQUET', variables=None)

Exports the results of a PQL query as pyarrow.parquet.ParquetFile and returns the path to the exported file. Uses Analysis.get_data_file.

Parameters:

Name Type Description Default
pql_query PQL

The table query to be executed.

required
file_path Union[str, pathlib.Path]

The output path for the export. Defaults to tmpdir/celonis_pql_export_<current_time>.parquet.

None
export_type str

Export filetype. One of [PARQUET, EXCEL, CSV].

'PARQUET'
variables List[Dict]

Only needed when PQL query contains saved formulas that contain variables.

None

Returns:

Type Description
Path

Path to downloaded file containing the results of the query.

create_saved_formula(self, name, description='', template='', parameters=None, **kwargs)

Creates a new Saved Formula. Uses Analysis.create_saved_formula.