11 Commits
Author SHA1 Message Date
Aaditya Srinivasan b034f456ee MINOR: [Docs][MATLAB][Python] Fixed three minor issues (#51379)
### Rationale for this change

Fix three minor issues as discussed in https://github.com/apache/arrow/pull/51358#issuecomment-5710568289

### What changes are included in this PR?

- Fix the punctuation in title-check comment.
- Remove an extra parenthesis from the `pyrunfile` link in the MATLAB documentation.
- Fix the `buffers` parameter name in the `buffers_to_array` documentation.

### Are these changes tested?

These are minor documentation fixes.

### Are there any user-facing changes?

Yes. 

### Was AI used for this PR?

In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR.

**PR code and description written by:**

- [X] Human
- [ ] AI

**Reviewed before submission by:**

- [X] Human
- [ ] AI
- [ ] Not reviewed

Authored-by: Aaditya Srinivasan <aadityasri03@gmail.com>
Signed-off-by: Antoine Pitrou <antoine@python.org>
2026-09-17 19:26:19 +02:00
Alenka Frim fe298b424f GH-49628: [Python][Interchange protocol] Suppress warnings for pandas 4.0.0 and update docs (#49630)
### Rationale for this change
Pandas is moving the dataframe interchange protocol out of the repo in the next major release (4.0.0).

### What changes are included in this PR?
Filterwarnings are added and the pandas example is removed from the interchange documentation.

### Are these changes tested?
Yes, via CI.

### Are there any user-facing changes?
No.

* GitHub Issue: #49628

Authored-by: AlenkaF <frim.alenka@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2026-04-07 11:02:15 +02:00
ChiLin ChiuandRaúl Cumplido 992bee2c83 GH-45619: [Python] Use f-string instead of string.format (#45629)
### Rationale for this change

See https://github.com/apache/arrow/issues/45619.

### What changes are included in this PR?

Refactor using f-string instead of `string.format`. But do not use f-string for following case,  `string.format` allows passing parameters, making the code more reusable.

https://github.com/apache/arrow/blob/0fbf9823542233c5f32c26534c34cc97ce3f0be2/python/pyarrow/parquet/core.py#L1624-L1695

### Are these changes tested?

Via CI.

### Are there any user-facing changes?

No.

* GitHub Issue: #45619

Lead-authored-by: Chilin Chiou <chilin.chiou@gmail.com>
Co-authored-by: Raúl Cumplido <raulcumplido@gmail.com>
Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
2025-05-12 14:34:49 +02:00
Josh Soref 6101d12676 GH-38944: [Python] Fix spelling (#38945)
### Rationale for this change

### What changes are included in this PR?

Spelling fixes to python/

### Are these changes tested?

### Are there any user-facing changes?

* Closes: #38944

Authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-12-01 09:30:13 +01:00
Alenka Frim 9afa848e64 GH-37050: [Python][Interchange protocol] Add a workaround for empty dataframes (#38037)
### Rationale for this change

The implementation of the DataFrame Interchange Protocol does not currently support consumption of dataframes with 0 number of chunks (empty dataframes).

### What changes are included in this PR?

Add a workaround to not error in this case.

### Are these changes tested?

Yes, added `test_empty_dataframe` in `python/pyarrow/tests/interchange/test_conversion.py`.

### Are there any user-facing changes?
No.
* Closes: #37050

Authored-by: AlenkaF <frim.alenka@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-10-10 13:18:35 +02:00
Alenka Frim db420c9cb6 GH-38034: [Python] DataFrame Interchange Protocol - correct dtype information for categorical columns (#38065)
### Rationale for this change
See: https://github.com/apache/arrow/issues/38034#issue-1927839216

### What changes are included in this PR?

The `f_string` for the columns with categorical dtype is now corrected to reflect the type of the indices from the dictionary data type. Bit width has been correct before. From the spec:

> For categoricals, the format string describes the type of the
              categorical in the data buffer. In case of a separate encoding of
              the categorical (e.g. an integer to string mapping), this can
              be derived from ``self.describe_categorical``.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

No.
* Closes: #38034

Authored-by: AlenkaF <frim.alenka@gmail.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
2023-10-10 06:05:24 +02:00
Alenka Frim 161510e413 GH-37145: [Python] support boolean columns with bitsize 1 in from_dataframe (#37975)
### Rationale for this change

Bit-packed booleans are currently not supported in the `from_dataframe` of the Dataframe Interchange Protocol.

Note: We currently represent booleans in the pyarrow implementation as `uint8` which will also need to be changed in a follow-up PR (see https://github.com/data-apis/dataframe-api/issues/227). 

### What changes are included in this PR?

This PR adds the support for bit-packed booleans when consuming a dataframe interchange object.

### Are these changes tested?

Only locally, currently!
* Closes: #37145

Lead-authored-by: AlenkaF <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Signed-off-by: AlenkaF <frim.alenka@gmail.com>
2023-10-05 17:16:09 +02:00
Alenka FrimandJoris Van den Bossche 334c93726f GH-37598: [Python][Interchange Protocol] Fix the from_dataframe implementation to use the column dtype (#37986)
### Rationale for this change

We have been defining buffer dtypes for string and timestamp types incorrectly in the DataFrame Interchange Protocol implementation. This PR is the first step to fix the error and is dealing with the `from_dataframe` part. The next two steps to solve the connected issue are:

2. Make sure other libraries have also updated their `from_dataframe` implementation
3. Fix the data buffer dtypes for strings and timestamps.

### What changes are included in this PR?

Fix the `from_dataframe` implementation to use the column dtype rather than the data buffer dtype to interpret the buffers. Only for the indices of the categorical column we still use buffer data type in order to convert the indices when constructing the `DictionaryArray`.

### Are these changes tested?

No new tests are added but all the existing tests should pass and with that the stability of the change is tested.

### Are there any user-facing changes?

No.
* Closes: #37598

Lead-authored-by: AlenkaF <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-10-05 11:02:23 +02:00
Alenka FrimandJoris Van den Bossche 1d75816204 GH-33980: [Docs][Python] Document DataFrame Interchange Protocol implementation and usage (#35835)
_edit: just added something_
* Closes: #33980

Lead-authored-by: AlenkaF <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-06-07 14:02:08 +02:00
Alenka Frim 6cf5e8984a GH-33926: [Python] DataFrame Interchange Protocol for pyarrow.RecordBatch (#34294)
### Rationale for this change
Add the implementation of the Dataframe Interchange Protocol for `pyarrow.RecordBatch`. The protocol is already implemented for pyarrow.Table, see https://github.com/apache/arrow/pull/14804.

### Are these changes tested?
Yes, tests are added to:

- python/pyarrow/tests/interchange/test_interchange_spec.py
- python/pyarrow/tests/interchange/test_conversion.py
* Closes: #33926

Authored-by: Alenka Frim <frim.alenka@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-02-28 10:59:52 +01:00
Alenka FrimandJoris Van den Bossche a83cc852ad GH-33346: [Python] DataFrame Interchange Protocol for pyarrow Table (#14804)
This PR implements the Dataframe Interchange Protocol for `pyarrow.Table`.
See: https://data-apis.org/dataframe-protocol/latest/index.html

Lead-authored-by: Alenka Frim <frim.alenka@gmail.com>
Co-authored-by: Alenka Frim <AlenkaF@users.noreply.github.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Signed-off-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
2023-01-13 11:10:42 +01:00