I am trying to convert dataframe to dictionary(as they are faster when filtering on key) I am currently using
t3 = time()
r={}
for i in df.index.unique():
r[i]=[]
r[i].append(df.loc[i].values)
print(round((time()-t3), 1), "s")
this type of conversion is slow. Is there an alternative to this? I want index of dataframe as key and row as values with multiple values on a single key