Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Pyarrow Table doesn't seem to have to_pylist() as a method

pyarrow documentation says that the Table class has a method called to_pylist which should return a list of dictionaries.

https://arrow.apache.org/docs/python/generated/pyarrow.Table.html#pyarrow.Table.to_pylist

When I run their code example:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

import pyarrow as pa
import pandas as pd
df = pd.DataFrame({'n_legs': [2, 4, 5, 100],
                   'animals': ["Flamingo", "Horse", "Brittle stars", "Centipede"]})
table = pa.Table.from_pandas(df)
table.to_pylist()

I get the following attributeerror:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'pyarrow.lib.Table' object has no attribute 'to_pylist'

Has to_pylist been removed or is there something wrong with my package?

>Solution :

Method to_pylist was added to pa.Table in version 7.0.0. As suggested, could you check that the version of pyarrow you are using is not older?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading