nested2dataframe


Namenested2dataframe JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/nested2dataframe
SummaryTransforms a nested dictionary or iterable into a Pandas DataFrame
upload_time2023-10-10 23:40:38
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords nested dict dataframe json
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Transforms a nested dictionary or iterable into a Pandas DataFrame.

## Tested against Windows / Python 3.11 / Anaconda

## pip install nested2dataframe

```python
	

This function takes a nested dictionary or iterable and converts it into a Pandas DataFrame where each level of nesting
is represented as a separate column. The function is designed to handle dictionaries with varying levels of nesting,
and it can handle missing values, such as NaN or None, and fill them with the specified `tmpnone` value.

Parameters:
- it (dict or iterable): The input nested dictionary or iterable.
- key_prefix (str, optional): The prefix to use for naming the columns representing each level of nesting.
  Defaults to "level_".
- tmpnone (any, optional): The value to replace NaN or None values in the DataFrame. Defaults to "NANVALUE".
- fillna (any, optional): The value to fill NaN values in the final DataFrame. Defaults to pd.NA.
- optimize_dtypes (bool, optional): Whether to optimize the data types of the DataFrame columns. If True,
  it will attempt to reduce memory usage by changing data types where possible. Defaults to True.

Returns:
- pandas.DataFrame: A Pandas DataFrame where each level of nesting is represented as a separate column.

Example:
	from nested2dataframe import nestediter2df
	d7 = {
		"results": [
			{
				"end_time": "2021-01-21",
				"key": "q1",
				"result_type": "multipleChoice",
				"start_time": "2021-01-21",
				"value": ["1"],
			},
			{
				"end_time": "2021-01-21",
				"key": "q2",
				"result_type": "multipleChoice",
				"start_time": "2021-01-21",
				"value": ["False"],
			},
			{
				"end_time": "2021-01-21",
				"key": "q3",
				"result_type": "multipleChoice",
				"start_time": "2021-01-21",
				"value": ["3"],
			},
			{
				"end_time": "2021-01-21",
				"key": "q4",
				"result_type": "multipleChoice",
				"start_time": "2021-01-21",
				"value": ["3"],
			},
		]
	}

	df77 = nestediter2df(d7)
	print(df77.to_string())

	#    level_1  level_2 level_3    end_time key     result_type  start_time      0
	# 0  results        0   value  2021-01-21  q1  multipleChoice  2021-01-21      1
	# 1  results        1   value  2021-01-21  q2  multipleChoice  2021-01-21  False
	# 2  results        2   value  2021-01-21  q3  multipleChoice  2021-01-21      3
	# 3  results        3   value  2021-01-21  q4  multipleChoice  2021-01-21      3




d1 = {
    "level1": {
        "t1": {
            "s1": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
            "s2": {"col1": 1, "col2": 5, "col3": 4, "col4": 8},
            "s3": {"col1": 11, "col2": 8, "col3": 2, "col4": 9},
            "s4": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
        },
        "t2": {
            "s1": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
            "s2": {"col1": 1, "col2": 5, "col3": 4, "col4": 8},
            "s3": {"col1": 11, "col2": 8, "col3": 2, "col4": 9},
            "s4": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
        },
        "t3": {
            "s1": {"col1": 1, "col2": 2, "col3": 3, "col4": 4},
            "s2": {"col1": 5, "col2": 6, "col3": 7, "col4": 8},
            "s3": {"col1": 9, "col2": 10, "col3": 11, "col4": 12},
            "s4": {"col1": 13, "col2": 14, "col3": 15, "col4": 16},
        },
    },
    "level2": {
        "t1": {
            "s1": {"col1": 5, "col2": 4, "col3": 9, "col4": 9},
            "s2": {"col1": 1, "col2": 5, "col3": 4, "col4": 5},
            "s3": {"col1": 11, "col2": 8, "col3": 2, "col4": 13},
            "s4": {"col1": 5, "col2": 4, "col3": 4, "col4": 20},
        },
        "t2": {
            "s1": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
            "s2": {"col1": 1, "col2": 5, "col3": 4, "col4": 8},
            "s3": {"col1": 11, "col2": 8, "col3": 2, "col4": 9},
            "s4": {"col1": 5, "col2": 4, "col3": 4, "col4": 9},
        },
        "t3": {
            "s1": {"col1": 1, "col2": 2, "col3": 3, "col4": 4},
            "s2": {"col1": 5, "col2": 6, "col3": 7, "col4": 8},
            "s3": {"col1": 9, "col2": 10, "col3": 11, "col4": 12},
            "s4": {"col1": 13, "col2": 14, "col3": 15, "col4": 16},
        },
    },
}
#    level_1 level_2 level_3  col1  col2  col3  col4
# 0   level1      t1      s1     5     4     4     9
# 1   level1      t1      s2     1     5     4     8
# 2   level1      t1      s3    11     8     2     9
# 3   level1      t1      s4     5     4     4     9
# 4   level1      t2      s1     5     4     4     9
# 5   level1      t2      s2     1     5     4     8
# 6   level1      t2      s3    11     8     2     9
# 7   level1      t2      s4     5     4     4     9
# 8   level1      t3      s1     1     2     3     4
# 9   level1      t3      s2     5     6     7     8
# 10  level1      t3      s3     9    10    11    12
# 11  level1      t3      s4    13    14    15    16
# 12  level2      t1      s1     5     4     9     9
# 13  level2      t1      s2     1     5     4     5
# 14  level2      t1      s3    11     8     2    13
# 15  level2      t1      s4     5     4     4    20
# 16  level2      t2      s1     5     4     4     9
# 17  level2      t2      s2     1     5     4     8
# 18  level2      t2      s3    11     8     2     9
# 19  level2      t2      s4     5     4     4     9
# 20  level2      t3      s1     1     2     3     4
# 21  level2      t3      s2     5     6     7     8
# 22  level2      t3      s3     9    10    11    12
# 23  level2      t3      s4    13    14    15    16


d3 = [
    {
        "cb": ({"ID": 1, "Name": "A", "num": 50}, {"ID": 2, "Name": "A", "num": 68}),
    },
    {
        "cb": ({"ID": 1, "Name": "A", "num": 50}, {"ID": 4, "Name": "A", "num": 67}),
    },
    {
        "cb": (
            {"ID": 1, "Name": "A", "num": 50},
            {"ID": 6, "Name": "A", "num": 67, "bubu": {"bibi": 3}},
        ),
    },
]

#    level_1  level_2    end_time key     result_type  start_time  value
# 0  results        0  2021-01-21  q1  multipleChoice  2021-01-21      1
# 1  results        1  2021-01-21  q2  multipleChoice  2021-01-21  False
# 2  results        2  2021-01-21  q3  multipleChoice  2021-01-21      3
# 3  results        3  2021-01-21  q4  multipleChoice  2021-01-21      x


df33 = nestediter2df(d3)
print(df33.to_string())

#    level_1 level_2  level_3 level_4  ID Name  num  bibi
# 0        0      cb        0     NaN   1    A   50  <NA>
# 1        0      cb        1     NaN   2    A   68  <NA>
# 2        1      cb        0     NaN   1    A   50  <NA>
# 3        1      cb        1     NaN   4    A   67  <NA>
# 4        2      cb        0     NaN   1    A   50  <NA>
# 5        2      cb        1    bubu   6    A   67     3

d4 = {
    "critic_reviews": [
        {"review_critic": "XYZ", "review_score": 90},
        {"review_critic": "ABC", "review_score": 90},
        {"review_critic": "123", "review_score": 90},
    ],
    "genres": ["Sports", "Golf"],
    "score": 85,
    "title": "Golf Simulator",
    "url": "http://example.com/golf-simulator",
}

df44 = nestediter2df(d4)
print(df44.to_string())

#           level_1  level_2 review_critic  review_score       0     1  score           title                                url
# 0  critic_reviews        0           XYZ            90     NaN   NaN   <NA>             NaN                                NaN
# 1  critic_reviews        1           ABC            90     NaN   NaN   <NA>             NaN                                NaN
# 2  critic_reviews        2           123            90     NaN   NaN   <NA>             NaN                                NaN
# 3          genres     <NA>          <NA>          <NA>  Sports  Golf   <NA>             NaN                                NaN
# 4            <NA>     <NA>          <NA>          <NA>     NaN   NaN     85  Golf Simulator  http://example.com/golf-simulator

d5 = {
    "c1": {
        "application_contacts": {"adress": "X", "email": "test@test.com"},
        "application_details": {"email": None, "phone": None},
        "employer": {"Name": "Nom", "email": "bibi@baba.com"},
        "id": "1",
    },
    "c2": {
        "application_contacts": {"adress": "Z", "email": None},
        "application_details": {"email": "testy@test_a.com", "phone": None},
        "employer": {"Name": "Nom", "email": None},
        "id": "2",
    },
    "c3": {
        "application_contacts": {"adress": "Y", "email": None},
        "application_details": {"email": "testy@test_a.com", "phone": None},
        "employer": {"Name": "Nom", "email": None},
        "id": "3",
    },
}

df55 = nestediter2df(d5)
print(df55.to_string())

#    level_1               level_2 adress             email phone Name    id
# 0       c1  application_contacts      X     test@test.com  <NA>  NaN  <NA>
# 1       c1   application_details   <NA>              <NA>  <NA>  NaN  <NA>
# 2       c1              employer   <NA>     bibi@baba.com  <NA>  Nom  <NA>
# 3       c1                  <NA>   <NA>              <NA>  <NA>  NaN     1
# 4       c2  application_contacts      Z              <NA>  <NA>  NaN  <NA>
# 5       c2   application_details   <NA>  testy@test_a.com  <NA>  NaN  <NA>
# 6       c2              employer   <NA>              <NA>  <NA>  Nom  <NA>
# 7       c2                  <NA>   <NA>              <NA>  <NA>  NaN     2
# 8       c3  application_contacts      Y              <NA>  <NA>  NaN  <NA>
# 9       c3   application_details   <NA>  testy@test_a.com  <NA>  NaN  <NA>
# 10      c3              employer   <NA>              <NA>  <NA>  Nom  <NA>
# 11      c3                  <NA>   <NA>              <NA>  <NA>  NaN     3

d6 = {
    "departure": [
        {
            "actual": None,
            "actual_runway": None,
            "airport": "Findel",
            "delay": None,
            "estimated": "2020-07-07T06:30:00+00:00",
            "estimated_runway": None,
            "gate": None,
            "iata": "LUX",
            "icao": "ELLX",
            "scheduled": "2020-07-07T06:30:00+00:00",
            "terminal": None,
            "timezone": "Europe/Luxembourg",
        },
        {
            "actual": None,
            "actual_runway": None,
            "airport": "Findel",
            "delay": None,
            "estimated": "2020-07-07T06:30:00+00:00",
            "estimated_runway": None,
            "gate": None,
            "iata": "LUX",
            "icao": "ELLX",
            "scheduled": "2020-07-07T06:30:00+00:00",
            "terminal": None,
            "timezone": "Europe/Luxembourg",
        },
        {
            "actual": None,
            "actual_runway": None,
            "airport": "Findel",
            "delay": None,
            "estimated": "2020-07-07T06:30:00+00:00",
            "estimated_runway": None,
            "gate": None,
            "iata": "LUX",
            "icao": "ELLX",
            "scheduled": "2020-07-07T06:30:00+00:00",
            "terminal": None,
            "timezone": "Europe/Luxembourg",
        },
    ]
}


df66 = nestediter2df(d6)
print(df66.to_string())

#      level_1  level_2 actual actual_runway airport delay                  estimated estimated_runway  gate iata  icao                  scheduled terminal           timezone
# 0  departure        0   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg
# 1  departure        1   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg
# 2  departure        2   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg

```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/nested2dataframe",
    "name": "nested2dataframe",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "nested,dict,DataFrame,json",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/80/df/baaab0fc6eec9ac5f77b1b75cfe694032bbe2928d99226e085b7d44f11af/nested2dataframe-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# Transforms a nested dictionary or iterable into a Pandas DataFrame.\r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n## pip install nested2dataframe\r\n\r\n```python\r\n\t\r\n\r\nThis function takes a nested dictionary or iterable and converts it into a Pandas DataFrame where each level of nesting\r\nis represented as a separate column. The function is designed to handle dictionaries with varying levels of nesting,\r\nand it can handle missing values, such as NaN or None, and fill them with the specified `tmpnone` value.\r\n\r\nParameters:\r\n- it (dict or iterable): The input nested dictionary or iterable.\r\n- key_prefix (str, optional): The prefix to use for naming the columns representing each level of nesting.\r\n  Defaults to \"level_\".\r\n- tmpnone (any, optional): The value to replace NaN or None values in the DataFrame. Defaults to \"NANVALUE\".\r\n- fillna (any, optional): The value to fill NaN values in the final DataFrame. Defaults to pd.NA.\r\n- optimize_dtypes (bool, optional): Whether to optimize the data types of the DataFrame columns. If True,\r\n  it will attempt to reduce memory usage by changing data types where possible. Defaults to True.\r\n\r\nReturns:\r\n- pandas.DataFrame: A Pandas DataFrame where each level of nesting is represented as a separate column.\r\n\r\nExample:\r\n\tfrom nested2dataframe import nestediter2df\r\n\td7 = {\r\n\t\t\"results\": [\r\n\t\t\t{\r\n\t\t\t\t\"end_time\": \"2021-01-21\",\r\n\t\t\t\t\"key\": \"q1\",\r\n\t\t\t\t\"result_type\": \"multipleChoice\",\r\n\t\t\t\t\"start_time\": \"2021-01-21\",\r\n\t\t\t\t\"value\": [\"1\"],\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"end_time\": \"2021-01-21\",\r\n\t\t\t\t\"key\": \"q2\",\r\n\t\t\t\t\"result_type\": \"multipleChoice\",\r\n\t\t\t\t\"start_time\": \"2021-01-21\",\r\n\t\t\t\t\"value\": [\"False\"],\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"end_time\": \"2021-01-21\",\r\n\t\t\t\t\"key\": \"q3\",\r\n\t\t\t\t\"result_type\": \"multipleChoice\",\r\n\t\t\t\t\"start_time\": \"2021-01-21\",\r\n\t\t\t\t\"value\": [\"3\"],\r\n\t\t\t},\r\n\t\t\t{\r\n\t\t\t\t\"end_time\": \"2021-01-21\",\r\n\t\t\t\t\"key\": \"q4\",\r\n\t\t\t\t\"result_type\": \"multipleChoice\",\r\n\t\t\t\t\"start_time\": \"2021-01-21\",\r\n\t\t\t\t\"value\": [\"3\"],\r\n\t\t\t},\r\n\t\t]\r\n\t}\r\n\r\n\tdf77 = nestediter2df(d7)\r\n\tprint(df77.to_string())\r\n\r\n\t#    level_1  level_2 level_3    end_time key     result_type  start_time      0\r\n\t# 0  results        0   value  2021-01-21  q1  multipleChoice  2021-01-21      1\r\n\t# 1  results        1   value  2021-01-21  q2  multipleChoice  2021-01-21  False\r\n\t# 2  results        2   value  2021-01-21  q3  multipleChoice  2021-01-21      3\r\n\t# 3  results        3   value  2021-01-21  q4  multipleChoice  2021-01-21      3\r\n\r\n\r\n\r\n\r\nd1 = {\r\n    \"level1\": {\r\n        \"t1\": {\r\n            \"s1\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n            \"s2\": {\"col1\": 1, \"col2\": 5, \"col3\": 4, \"col4\": 8},\r\n            \"s3\": {\"col1\": 11, \"col2\": 8, \"col3\": 2, \"col4\": 9},\r\n            \"s4\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n        },\r\n        \"t2\": {\r\n            \"s1\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n            \"s2\": {\"col1\": 1, \"col2\": 5, \"col3\": 4, \"col4\": 8},\r\n            \"s3\": {\"col1\": 11, \"col2\": 8, \"col3\": 2, \"col4\": 9},\r\n            \"s4\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n        },\r\n        \"t3\": {\r\n            \"s1\": {\"col1\": 1, \"col2\": 2, \"col3\": 3, \"col4\": 4},\r\n            \"s2\": {\"col1\": 5, \"col2\": 6, \"col3\": 7, \"col4\": 8},\r\n            \"s3\": {\"col1\": 9, \"col2\": 10, \"col3\": 11, \"col4\": 12},\r\n            \"s4\": {\"col1\": 13, \"col2\": 14, \"col3\": 15, \"col4\": 16},\r\n        },\r\n    },\r\n    \"level2\": {\r\n        \"t1\": {\r\n            \"s1\": {\"col1\": 5, \"col2\": 4, \"col3\": 9, \"col4\": 9},\r\n            \"s2\": {\"col1\": 1, \"col2\": 5, \"col3\": 4, \"col4\": 5},\r\n            \"s3\": {\"col1\": 11, \"col2\": 8, \"col3\": 2, \"col4\": 13},\r\n            \"s4\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 20},\r\n        },\r\n        \"t2\": {\r\n            \"s1\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n            \"s2\": {\"col1\": 1, \"col2\": 5, \"col3\": 4, \"col4\": 8},\r\n            \"s3\": {\"col1\": 11, \"col2\": 8, \"col3\": 2, \"col4\": 9},\r\n            \"s4\": {\"col1\": 5, \"col2\": 4, \"col3\": 4, \"col4\": 9},\r\n        },\r\n        \"t3\": {\r\n            \"s1\": {\"col1\": 1, \"col2\": 2, \"col3\": 3, \"col4\": 4},\r\n            \"s2\": {\"col1\": 5, \"col2\": 6, \"col3\": 7, \"col4\": 8},\r\n            \"s3\": {\"col1\": 9, \"col2\": 10, \"col3\": 11, \"col4\": 12},\r\n            \"s4\": {\"col1\": 13, \"col2\": 14, \"col3\": 15, \"col4\": 16},\r\n        },\r\n    },\r\n}\r\n#    level_1 level_2 level_3  col1  col2  col3  col4\r\n# 0   level1      t1      s1     5     4     4     9\r\n# 1   level1      t1      s2     1     5     4     8\r\n# 2   level1      t1      s3    11     8     2     9\r\n# 3   level1      t1      s4     5     4     4     9\r\n# 4   level1      t2      s1     5     4     4     9\r\n# 5   level1      t2      s2     1     5     4     8\r\n# 6   level1      t2      s3    11     8     2     9\r\n# 7   level1      t2      s4     5     4     4     9\r\n# 8   level1      t3      s1     1     2     3     4\r\n# 9   level1      t3      s2     5     6     7     8\r\n# 10  level1      t3      s3     9    10    11    12\r\n# 11  level1      t3      s4    13    14    15    16\r\n# 12  level2      t1      s1     5     4     9     9\r\n# 13  level2      t1      s2     1     5     4     5\r\n# 14  level2      t1      s3    11     8     2    13\r\n# 15  level2      t1      s4     5     4     4    20\r\n# 16  level2      t2      s1     5     4     4     9\r\n# 17  level2      t2      s2     1     5     4     8\r\n# 18  level2      t2      s3    11     8     2     9\r\n# 19  level2      t2      s4     5     4     4     9\r\n# 20  level2      t3      s1     1     2     3     4\r\n# 21  level2      t3      s2     5     6     7     8\r\n# 22  level2      t3      s3     9    10    11    12\r\n# 23  level2      t3      s4    13    14    15    16\r\n\r\n\r\nd3 = [\r\n    {\r\n        \"cb\": ({\"ID\": 1, \"Name\": \"A\", \"num\": 50}, {\"ID\": 2, \"Name\": \"A\", \"num\": 68}),\r\n    },\r\n    {\r\n        \"cb\": ({\"ID\": 1, \"Name\": \"A\", \"num\": 50}, {\"ID\": 4, \"Name\": \"A\", \"num\": 67}),\r\n    },\r\n    {\r\n        \"cb\": (\r\n            {\"ID\": 1, \"Name\": \"A\", \"num\": 50},\r\n            {\"ID\": 6, \"Name\": \"A\", \"num\": 67, \"bubu\": {\"bibi\": 3}},\r\n        ),\r\n    },\r\n]\r\n\r\n#    level_1  level_2    end_time key     result_type  start_time  value\r\n# 0  results        0  2021-01-21  q1  multipleChoice  2021-01-21      1\r\n# 1  results        1  2021-01-21  q2  multipleChoice  2021-01-21  False\r\n# 2  results        2  2021-01-21  q3  multipleChoice  2021-01-21      3\r\n# 3  results        3  2021-01-21  q4  multipleChoice  2021-01-21      x\r\n\r\n\r\ndf33 = nestediter2df(d3)\r\nprint(df33.to_string())\r\n\r\n#    level_1 level_2  level_3 level_4  ID Name  num  bibi\r\n# 0        0      cb        0     NaN   1    A   50  <NA>\r\n# 1        0      cb        1     NaN   2    A   68  <NA>\r\n# 2        1      cb        0     NaN   1    A   50  <NA>\r\n# 3        1      cb        1     NaN   4    A   67  <NA>\r\n# 4        2      cb        0     NaN   1    A   50  <NA>\r\n# 5        2      cb        1    bubu   6    A   67     3\r\n\r\nd4 = {\r\n    \"critic_reviews\": [\r\n        {\"review_critic\": \"XYZ\", \"review_score\": 90},\r\n        {\"review_critic\": \"ABC\", \"review_score\": 90},\r\n        {\"review_critic\": \"123\", \"review_score\": 90},\r\n    ],\r\n    \"genres\": [\"Sports\", \"Golf\"],\r\n    \"score\": 85,\r\n    \"title\": \"Golf Simulator\",\r\n    \"url\": \"http://example.com/golf-simulator\",\r\n}\r\n\r\ndf44 = nestediter2df(d4)\r\nprint(df44.to_string())\r\n\r\n#           level_1  level_2 review_critic  review_score       0     1  score           title                                url\r\n# 0  critic_reviews        0           XYZ            90     NaN   NaN   <NA>             NaN                                NaN\r\n# 1  critic_reviews        1           ABC            90     NaN   NaN   <NA>             NaN                                NaN\r\n# 2  critic_reviews        2           123            90     NaN   NaN   <NA>             NaN                                NaN\r\n# 3          genres     <NA>          <NA>          <NA>  Sports  Golf   <NA>             NaN                                NaN\r\n# 4            <NA>     <NA>          <NA>          <NA>     NaN   NaN     85  Golf Simulator  http://example.com/golf-simulator\r\n\r\nd5 = {\r\n    \"c1\": {\r\n        \"application_contacts\": {\"adress\": \"X\", \"email\": \"test@test.com\"},\r\n        \"application_details\": {\"email\": None, \"phone\": None},\r\n        \"employer\": {\"Name\": \"Nom\", \"email\": \"bibi@baba.com\"},\r\n        \"id\": \"1\",\r\n    },\r\n    \"c2\": {\r\n        \"application_contacts\": {\"adress\": \"Z\", \"email\": None},\r\n        \"application_details\": {\"email\": \"testy@test_a.com\", \"phone\": None},\r\n        \"employer\": {\"Name\": \"Nom\", \"email\": None},\r\n        \"id\": \"2\",\r\n    },\r\n    \"c3\": {\r\n        \"application_contacts\": {\"adress\": \"Y\", \"email\": None},\r\n        \"application_details\": {\"email\": \"testy@test_a.com\", \"phone\": None},\r\n        \"employer\": {\"Name\": \"Nom\", \"email\": None},\r\n        \"id\": \"3\",\r\n    },\r\n}\r\n\r\ndf55 = nestediter2df(d5)\r\nprint(df55.to_string())\r\n\r\n#    level_1               level_2 adress             email phone Name    id\r\n# 0       c1  application_contacts      X     test@test.com  <NA>  NaN  <NA>\r\n# 1       c1   application_details   <NA>              <NA>  <NA>  NaN  <NA>\r\n# 2       c1              employer   <NA>     bibi@baba.com  <NA>  Nom  <NA>\r\n# 3       c1                  <NA>   <NA>              <NA>  <NA>  NaN     1\r\n# 4       c2  application_contacts      Z              <NA>  <NA>  NaN  <NA>\r\n# 5       c2   application_details   <NA>  testy@test_a.com  <NA>  NaN  <NA>\r\n# 6       c2              employer   <NA>              <NA>  <NA>  Nom  <NA>\r\n# 7       c2                  <NA>   <NA>              <NA>  <NA>  NaN     2\r\n# 8       c3  application_contacts      Y              <NA>  <NA>  NaN  <NA>\r\n# 9       c3   application_details   <NA>  testy@test_a.com  <NA>  NaN  <NA>\r\n# 10      c3              employer   <NA>              <NA>  <NA>  Nom  <NA>\r\n# 11      c3                  <NA>   <NA>              <NA>  <NA>  NaN     3\r\n\r\nd6 = {\r\n    \"departure\": [\r\n        {\r\n            \"actual\": None,\r\n            \"actual_runway\": None,\r\n            \"airport\": \"Findel\",\r\n            \"delay\": None,\r\n            \"estimated\": \"2020-07-07T06:30:00+00:00\",\r\n            \"estimated_runway\": None,\r\n            \"gate\": None,\r\n            \"iata\": \"LUX\",\r\n            \"icao\": \"ELLX\",\r\n            \"scheduled\": \"2020-07-07T06:30:00+00:00\",\r\n            \"terminal\": None,\r\n            \"timezone\": \"Europe/Luxembourg\",\r\n        },\r\n        {\r\n            \"actual\": None,\r\n            \"actual_runway\": None,\r\n            \"airport\": \"Findel\",\r\n            \"delay\": None,\r\n            \"estimated\": \"2020-07-07T06:30:00+00:00\",\r\n            \"estimated_runway\": None,\r\n            \"gate\": None,\r\n            \"iata\": \"LUX\",\r\n            \"icao\": \"ELLX\",\r\n            \"scheduled\": \"2020-07-07T06:30:00+00:00\",\r\n            \"terminal\": None,\r\n            \"timezone\": \"Europe/Luxembourg\",\r\n        },\r\n        {\r\n            \"actual\": None,\r\n            \"actual_runway\": None,\r\n            \"airport\": \"Findel\",\r\n            \"delay\": None,\r\n            \"estimated\": \"2020-07-07T06:30:00+00:00\",\r\n            \"estimated_runway\": None,\r\n            \"gate\": None,\r\n            \"iata\": \"LUX\",\r\n            \"icao\": \"ELLX\",\r\n            \"scheduled\": \"2020-07-07T06:30:00+00:00\",\r\n            \"terminal\": None,\r\n            \"timezone\": \"Europe/Luxembourg\",\r\n        },\r\n    ]\r\n}\r\n\r\n\r\ndf66 = nestediter2df(d6)\r\nprint(df66.to_string())\r\n\r\n#      level_1  level_2 actual actual_runway airport delay                  estimated estimated_runway  gate iata  icao                  scheduled terminal           timezone\r\n# 0  departure        0   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg\r\n# 1  departure        1   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg\r\n# 2  departure        2   <NA>          <NA>  Findel  <NA>  2020-07-07T06:30:00+00:00             <NA>  <NA>  LUX  ELLX  2020-07-07T06:30:00+00:00     <NA>  Europe/Luxembourg\r\n\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Transforms a nested dictionary or iterable into a Pandas DataFrame",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/nested2dataframe"
    },
    "split_keywords": [
        "nested",
        "dict",
        "dataframe",
        "json"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eabcc08a1dc77ec8a2befb2ff8f1e7a90242bd7371fbdf7564ac13553d3021cc",
                "md5": "c7970306ae63c13a982c4647e097014d",
                "sha256": "951bd7c94851c0da0a527d2961437128caf8962b57fabdf95e33edd1ca5a780b"
            },
            "downloads": -1,
            "filename": "nested2dataframe-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c7970306ae63c13a982c4647e097014d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 26450,
            "upload_time": "2023-10-10T23:40:37",
            "upload_time_iso_8601": "2023-10-10T23:40:37.008844Z",
            "url": "https://files.pythonhosted.org/packages/ea/bc/c08a1dc77ec8a2befb2ff8f1e7a90242bd7371fbdf7564ac13553d3021cc/nested2dataframe-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80dfbaaab0fc6eec9ac5f77b1b75cfe694032bbe2928d99226e085b7d44f11af",
                "md5": "789c334c62d3226cb37b78dbd494dc3a",
                "sha256": "1176195a5a4e3ded5030d24b2c4b85ffceed409a2f62b854fbc050df335796cd"
            },
            "downloads": -1,
            "filename": "nested2dataframe-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "789c334c62d3226cb37b78dbd494dc3a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26268,
            "upload_time": "2023-10-10T23:40:38",
            "upload_time_iso_8601": "2023-10-10T23:40:38.971099Z",
            "url": "https://files.pythonhosted.org/packages/80/df/baaab0fc6eec9ac5f77b1b75cfe694032bbe2928d99226e085b7d44f11af/nested2dataframe-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-10 23:40:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "nested2dataframe",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "nested2dataframe"
}
        
Elapsed time: 0.12272s