I'd like to remove a 'double row' index header of a pivot result, so the following table:
Course_ID   CID-1   CID-2   CID-3
ID          
1           3.5     2.0     3.0
2           4.0     3.0     NaN
would look like this:
ID          CID-1   CID-2   CID-3           
1           3.5     2.0     3.0
2           4.0     3.0     NaN
How may I achieve this?
Here's the sample code:
sample = pd.DataFrame({'ID': [1, 1, 1, 2, 2], 
                       'Course_ID': ['CID-1', 'CID-2', 'CID-3', 'CID-1', 'CID-2'], 
                       'Grade': [3.5, 2, 3, 4, 3]})
result = pd.pivot_table(sample, index='ID', columns='Course_ID', values='Grade')
 
     
    