>>> import json
>>> import dtoolkit.accessor
>>> import pandas as pd
>>> df = pd.DataFrame(
... {
... "x" : ["A", "A", "B", "B", "B"],
... "y" : ["a", "b", "c", "d", "d"],
... "z" : ["1", "2", "3", "3", "4"],
... }
... )
>>> df
x y z
0 A a 1
1 A b 2
2 B c 3
3 B d 3
4 B d 4
Turn the above case into the following case.
>>> import json
>>> import dtoolkit.accessor
>>> import pandas as pd
>>> df = func(
... {
... "A": {
... "a": ["1"],
... "b": ["2"],
... },
... "B": {
... "c": ["3"],
... "d": ["3", "4"],
... },
... }
... )
>>> df
x y z
0 A a 1
1 A b 2
2 B c 3
3 B d 3
4 B d 4
Turn the above case into the following case.