def rectangularize_featureset(featureset):
    """Convert xarray.Dataset into (2d) Pandas.DataFrame for use with sklearn."""
    featureset = featureset.drop([coord for coord in ['target', 'class']
                                  if featureset in coord])
    feature_df = featureset.to_dataframe()
    if 'channel' in featureset:
        feature_df = feature_df.unstack(level='channel')
        if len(featureset.channel) == 1:
            feature_df.columns = [pair[0] for pair in feature_df.columns]
        else:
            feature_df.columns = ['_'.join([str(el) for el in pair])
                                  for pair in feature_df.columns]
    return feature_df.loc[featureset.name]  # preserve original row ordering
dataset/ETHPy150Open cesium-ml/cesium/cesium/build_model.py/rectangularize_featureset/swapped operands of `in`