I am currently importing a file as so:
df= pd.read_csv(r"Test.csv")
And the output looks like
Type Value
0 Food_Place_1 1
1 Food_Place_2 2
2 Car_Type_1 3
3 Car_Type_2 4
I would like to iterate through this df and depending on the Type column allocated to a dictionary like this
food_type_dict = {'Type': ['Food_Place_1', 'Food_Place_2'], 'Value': [1, 2]}
car_type_dict = {'Type': ['Car_Type_1', 'Car_Type_2'], 'Value': [3, 4]}
My plan was to convert the entire dataframe into a dictionary and filter from there. However when I try to convert using this, the output is not what I was expecting. I can't seem to remove the Value header from the dictionary
df_dict = df.set_index(['Type']).T.to_dict('dict')
Output
{'A1': {'Value': 1},....}