제가 csv를 불러와서 사전안에 사전형태로 넣고 싶은데요.
{test1:{testgroup3:{a:100,
b:200,
c:200},
testgroup2{a:100,
b:1000,
c:200},
testgroup{a:200,
b:100,
c:200}},
test2{testgroup3{a:200,
b:100,
c:200}},
testgroup2{a:200,
b:100,
c:200}},
testgroup{a:200,
b:100,
c:200}}}
이런식으로 사전안에 사전 형식을 만들고 싶습니다.
import pandas as pd
df = pd.read_csv('csv.csv',sep=',')
dict1 = df.set_index('campaign').to_dict('list')
dict2 = df.to_dict(orient="index")
print(dict2)
여기 까지 하고나서 더이상 어떻게 해야할지 모르겠네요.
csv 파일은 다음과 같은 형식입니다.
campaign 그룹 a b c
test1 testgroup1 100 200 200