Skip to content

Commit ebbbc21

Browse files
committed
FIX: fixed adapter for feather files (via pyarrow) with pandas indexes
1 parent d074bfe commit ebbbc21

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

‎larray_editor/arrayadapter.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,16 @@ def get_values(self, h_start, v_start, h_stop, v_stop):
20712071
combined = pyarrow.concat_batches(batches)
20722072
else:
20732073
combined = batches[0]
2074-
return combined[v_start - chunk_start:v_stop - chunk_start].to_pandas().values
2074+
2075+
chunk = combined[v_start - chunk_start:v_stop - chunk_start]
2076+
2077+
# not going via to_pandas() because it "eats" index columns
2078+
columns = chunk.columns
2079+
np_columns = [c.to_numpy(zero_copy_only=False) for c in columns]
2080+
try:
2081+
return np.stack(np_columns, axis=1)
2082+
except np.exceptions.DTypePromotionError:
2083+
return np.stack(np_columns, axis=1, dtype=object)
20752084

20762085

20772086
@adapter_for('pyarrow.parquet.ParquetFile')

0 commit comments

Comments
 (0)