def pivot_simple(index, columns, values):
 if ((len(index) != len(columns)) or (len(columns) != len(values))):
  raise AssertionError('Length of index, columns, and values must be the same')
 if (len(index) == 0):
  return DataFrame(index=[])
 hindex = MultiIndex.from_arrays([index, columns])
 series = Series(values.ravel(), index=hindex)
 series = series.sort_index(level=0)
 return series.unstack()

def pivot_simple ( index , columns , values ) : if ( ( len ( index ) != len ( columns ) ) or ( len ( columns ) != len ( values ) ) ) : raise AssertionError ( 'Length of index, columns, and values must be the same' ) if ( len ( index ) == 0 ) : return DataFrame ( index = [ ] ) hindex = MultiIndex . from_arrays ( [ index , columns ] ) series = Series ( values . ravel ( ) , index = hindex ) series = series . sort_index ( level = 0 ) return series . unstack ( )
produce pivot table based on 3 columns of this dataframe .