jorisvandenbossche commented on code in PR #48969:
URL: https://github.com/apache/arrow/pull/48969#discussion_r2750001373
##########
python/pyarrow/table.pxi:
##########
@@ -1877,10 +1877,12 @@ cdef class _Tabular(_PandasConvertible):
>>> df = pd.DataFrame({'year': [None, 2022, 2019, 2021],
... 'n_legs': [2, 4, 5, 100],
... 'animals': ["Flamingo", "Horse", None,
"Centipede"]})
- >>> table = pa.Table.from_pandas(df)
+ >>> table = pa.Table.from_arrays(
+ ... [[None, 2022, 2019, 2021], [2, 4, 5, 100], ["Flamingo",
"Horse", None, "Centipede"]],
+ ... names=['year', 'n_legs', 'animals'])
Review Comment:
Not too important, but for future changes: if we want to keep the docstring
examples as simple as possible, I would say that keeping the dict-type creation
(as it is with pd.DataFrame) is easier than the arrays. So this could also be
something like:
```python
>>> table = pa.table({'year': [None, 2022, 2019, 2021],
... 'n_legs': [2, 4, 5, 100],
... 'animals': ["Flamingo", "Horse", None,
"Centipede"]})
```
i.e. essentially just swapping `pd.DataFrame(..)` with `pa.table(..)`
(also, the `df` creation can now be removed from the example, because it is
no longer used)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]