AlenkaF commented on code in PR #34294: URL: https://github.com/apache/arrow/pull/34294#discussion_r1118426440
########## python/pyarrow/interchange/dataframe.py: ########## @@ -154,19 +162,28 @@ def select_columns(self, indices: Sequence[int]) -> _PyArrowDataFrame: """ Create a new DataFrame by selecting a subset of columns by index. """ - return _PyArrowDataFrame( - self._df.select(list(indices)), self._nan_as_null, self._allow_copy - ) + if isinstance(self._df, pa.RecordBatch): + columns = [self._df.column(i) for i in indices] + names = [self._df.schema.names[i] for i in indices] + return _PyArrowDataFrame(pa.record_batch(columns, names=names)) + else: + return _PyArrowDataFrame( + self._df.select(list(indices)), self._nan_as_null, self._allow_copy Review Comment: Will do it in a separate PR (issue https://github.com/apache/arrow/issues/34359) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org