How to average a column in a pandas dataframe over an index in a multi-index

For the snippet to work, you need: positionInterface.cube.csv

import pandas as pd
import matplotlib.pyplot as plt
 
positioningData = pd.read_csv("positionInterface.cube.csv", comment='#', index_col=[0,1,2])
iterationAlpha = positioningData.groupby('ALPHA_STAR').ITERATIONS.mean()

This should lead to average values for the ITERATION column over the ALPHA_STAR index:

iterationAlpha

See also