Suppose dict = {'A':{1,2,4}, 'B':{5,6}}
, How to create a Pandas Dataframe like this:
Key Value 0 'A' {1,2,4} 1 'B' {5,6}
Advertisement
Answer
Try:
dct = {"A": {1, 2, 4}, "B": {5, 6}} df = pd.DataFrame({"Key": dct.keys(), "Value": dct.values()}) print(df)
Prints:
Key Value 0 A {1, 2, 4} 1 B {5, 6}