Problem
I want to pivot and group values. Despite looking through the guidance here, I cannot seem to find what I am looking for.
Reprex
What I have.
import pandas as pd
data_input = {'Area':['North', 'South', 'West', 'East','North', 'South', 'West', 'East'], 
              "Job1":["T", "F", "T", "X","T", "F", "T", "X"],
              "Job2":["F", "X", "T", "X","T", "F", "T", "X"],
              "Job3":["T", "F", "T", "X","X", "X", "F", "T"]}
 
# Create DataFrame
df1 = pd.DataFrame(data_input)
 
# Print the output.
print(df1)
What I want
# multi-level columns
items = pd.MultiIndex.from_tuples([('Job1', 'T'),('Job1', 'F'), ('Job1', 'X'),
                                 ('Job2', 'T'),('Job2', 'F'), ('Job2', 'X')])
# creating a DataFrame
dataFrame = pd.DataFrame([[2, 0, 0, 1, 1, 0], 
                          [0, 2, 0,0, 1, 1], 
                          [2, 0, 0,2, 0, 0], 
                          [0, 0, 2,0, 0, 2]],
                         index=['North', 'South', 'East', "West"],
                         columns=items)
# DataFrame
dataFrame


 
     
    