Using Pandas with PyMPX

Importing the pympx module will add extra functionality to the pandas module.

The extra functions behave in a similar way to pd.read_csv() and pd.DataFrame.to_csv()

Reading from Empower into a pandas DataFrame

For example pd.read_empower() returns a pandas DataFrame in the same way that pd.read_csv() does:


The returned dataframe contains the standard Empower fields, and the Empower custom fields. In the example above NewField is an Empower custom attribute. The column ID contains the Empower physid.


Typing the dot (.) symbol and then the [TAB] key will bring up the pandas autocomplete. If you type part of a method name you can see the matching methods in the dropdown list.


pd.read_empower() appears in the dropdown along with the standard pandas read functions.

Creating elements from csv, via a pandas DataFrame

Elements can be created from csv very easily, via a pandas DataFrame.

The one difficulty is to know that the DataFrame’s columns need renaming to the standard dimension field names

  • Short Name

  • Long Name

  • Description

  • Group Only

  • Calculation Status

  • Calculation

  • Colour

  • Measure Element

  • …and custom field longnames