PI DO:
>>> import pandas as pd
>>>
>>> aa = {"a": ["group_a", "group_b", "group_c"]}
>>> ab = {"b": ["x", "y"]}
>>> ba = {"c": ["group_b"]}
>>>
>>> c = {**aa, **ab, **ba}
>>>
>>> df = pd.DataFrame.from_dict(c, orient="index")
>>>
>>> print(df)
0 1 2
a group_a group_b group_c
b x y None
c groub_b None None
但我实际上是在寻找一种毒蛇般的方式来获得:
group_a group_b group_c x y
a 1 1 1 0 0
b 0 0 0 1 1
c 0 1 0 0 0