I would like to use the first type object (always starts with "document_") from this json as a row and all others as a column
[
[
{
"type": "document_type_bank_statement"
},
{
"type": "sender_iban"
},
{
"type": "sender_vat_id"
}
],
[
{
"type": "document_type_bank_statement"
},
{
"type": "sender_iban"
},
{
"type": "sender_vat_id"
}
],
[
{
"type": "document_type_invoice"
},
{
"type": "sender_zip"
}
]
]
Example:
| sender_iban | sender_vat_id | sender_zip | |
|---|---|---|---|
| document_type_bank_statement | 2 | 2 | 0 |
| document_type_invoice | 0 | 0 | 1 |
This will give me the first object:
for type in pagewise_data:
print(type[0]['type'])
So all the others:
for type in pagewise_data:
for i in type:
if not i['type'].startswith('document'):
print(i['type'])
This is how i get all types
for type in pagewise_data:
for i in type:
print(i['type'])
My question now is, how do i get this to work like in my given example table with pandas? so that you can also count the existing types that occur in an array block?
document_type_invoicehas far fewer columns thendocument_type_bank_statement?