Exporting Data to Pandas
Polymatheia supports exporting records into a Pandas DataFrame for further analysis / visualisation.
To write records to a DataFrame use the PandasDFWriter:
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 DataFrame must not contain any nested data, as demonstrated
in the example above. Any reader can also be passed to write(),
however the records provided by that reader must not contain any nested data.
You can use the transformation functionality to convert a nested structure into a a simple
structure ready for use with write().