Mapping dictionary with multiple key values to data frame

  pandas, python

I have a dictionary which has multiple key values.

dict = (0, 0, 'Shift 2 (2000 FT)'): 0.0, (0, 0, 'Shift 1 (0800 FT)'): 0.0, (0, 1, 'Shift 2 (2000 FT)'): 0.0, (0, 1, 'Shift 1 (0800 FT)'): 0.0, (0, 2, 'Shift 2 (2000 FT)'): 0.0, (0, 2, 'Shift 1 (0800 FT)'): 0.0}

I want to convert it to dataframe as follows where the first index is called ‘WEEK’, second called ‘DAY’ and the third goes to columns.

enter image description here

Please advise. Thanks!

Source: Python Questions

LEAVE A COMMENT