Reindex sublevel of pandas dataframe multiindex
问题 I have a time series dataframe and I would like to reindex it by Trials and Measurements. Simplified, I have this: value Trial 1 0 13 1 3 2 4 2 3 NaN 4 12 3 5 34 Which I want to turn into this: value Trial 1 0 13 1 3 2 4 2 0 NaN 1 12 3 0 34 How can I best do this? 回答1: Just yesterday, the illustrious Andy Hayden added this feature to version 0.13 of pandas, which will be released any day now. See here for usage example he added to the docs. If you are comfortable installing the development