Skip to content

The result of values_to_dict should contain columns or not? #588

Description

@Zeroto521

A DataFrame likes the following.

   x  y  z
0  A  a  1
1  A  b  2
2  B  c  3
3  B  d  3
4  B  d  4

values_to_dict could return like the following.

{
    "A": {
        "a": ["1"],
        "b": ["2"],
    },
    "B": {
        "c": ["3"],
        "d": ["3", "4"],
    },
}

The above result is missing columns.
So whether the result should contain columns like the following?

{
    [
        {
            "column": "x",
            "value": "A",
            "next": [
                {
                    "column": "y",
                    "value": "a",
                    "next": {"column": "1", "value": "z"},
                },
                {
                    "column": "y",
                    "value": "b",
                    "next": {"column": "2", "value": "z"},
                },
            ],
        },
        {
            "column": "x",
            "value": "B",
            "next": [
                {
                    "column": "y",
                    "value": "c",
                    "next": {"column": "3", "value": "z"},
                },
                {
                    "column": "y",
                    "value": "d",
                    "next": [
                        {"column": "3", "value": "z"},
                        {"column": "4", "value": "z"},
                    ],
                },
            ],
        },
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    ideaA prototype idea

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions