def _wrap_output(self, output, index, names=None):
output = output[self._selection_name]<EOL>if names is not None:<EOL><INDENT>return DataFrame(output, index=index, columns=names)<EOL><DEDENT>else:<EOL><INDENT>name = self._selection_name<EOL>if name is None:<EOL><INDENT>name = self._selected_obj.name<EOL><DEDENT>return Series(output, index=index, name=name)<EOL><DEDENT>
common agg/transform wrapping logic