Skip to content

Latest commit

 

History

History
38 lines (31 loc) · 1.25 KB

pandas.rst

File metadata and controls

38 lines (31 loc) · 1.25 KB

Exporting Data to Pandas

Polymatheia supports exporting records into a Pandas ~pandas.DataFrame for further analysis / visualisation. To write records to a ~pandas.DataFrame use the ~polymatheia.data.writer.PandasDFWriter:

python

from polymatheia.data.writer import PandasDFWriter

records = [
{

'id': 1, 'name': 'Test Person', 'age': 32

}, { 'id': 2, 'name': 'Another Test Person', 'age': 19 }, { 'id': 3, 'name': 'Final Person', 'age': 64 }

] writer = PandasDFWriter() df = writer.write(records)

Important

Records that are written to a Pandas ~pandas.DataFrame must not contain any nested data, as demonstrated in the example above. Any reader can also be passed to ~polymatheia.data.writer.PandasDFWriter.write, however the records provided by that reader must not contain any nested data.

You can use the transformation functionality <transforming> to convert a nested structure into a a simple structure ready for use with ~polymatheia.data.writer.PandasDFWriter.write.