Note that there are some explanatory texts on larger screens.

plurals
  1. PODict of dicts of dicts to DataFrame
    primarykey
    data
    text
    <p>I'd like to store JSON data in a Python Pandas DataFrame</p> <p>my JSON data is a dict of dicts of dicts like this</p> <pre><code>d = { "col1": { "row1": { "data1": "0.87", "data2": "Title col1", "data3": "14.4878", "data4": "Title row1" }, "row2": { "data1": "15352.3", "data2": "Title col1", "data3": "14.9561", "data4": "Title row2" }, "row3": { "data1": "0", "data2": "Title col1", "data3": "16.8293", "data4": "Title row3" } }, "col2": { "row1": { "data1": "0.87", "data2": "Title col2", "data3": "24.4878", "data4": "Title row1" }, "row2": { "data1": "15352.3", "data2": "Title col2", "data3": "24.9561", "data4": "Title row2" }, "row3": { "data1": "0", "data2": "Title col2", "data3": "26.8293", "data4": "Title row3" } } } </code></pre> <p>I did this to put my data in a DataFrame</p> <pre><code>import pandas as pd df=pd.DataFrame(d) </code></pre> <p>I get this</p> <pre><code>In [1]: df Out[1]: col1 col2 row1 {'data4': 'Title col1', 'data1': '0.87', 'data3': {'data4': 'Title col1', 'data1': '0.87', 'data3': row2 {'data4': 'Title col2', 'data1': '15352.3', 'data {'data4': 'Title col2', 'data1': '15352.3', 'data row3 {'data4': 'Title col3', 'data1': '0', 'data3': '1 {'data4': 'Title col3', 'data1': '0', 'data3': '2 </code></pre> <p>My problem is that my DataFrame contains dicts instead of values.</p> <p>I wonder how I can manage multidimensionnal data (more than 2 dimensions... 3 dimensions here) with a Pandas DataFrame.</p> <p>Each dict inside DataFrame have the same keys.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload