Return pivot table with given fieldnames as columns
(df,dim,fieldnames)
| 1694 | |
| 1695 | |
| 1696 | def _get_pivot_table(df,dim,fieldnames): |
| 1697 | """ |
| 1698 | Return pivot table with given fieldnames as columns |
| 1699 | """ |
| 1700 | level, axis = _get_dim(df,dim) |
| 1701 | # Unstack an index |
| 1702 | if axis==0: |
| 1703 | return df.unstack(level=level) |
| 1704 | # Pivot about a column |
| 1705 | elif axis==1: |
| 1706 | return df.pivot(columns=level,values=fieldnames) |
| 1707 | # Dimension not found, return dataframe |
| 1708 | else: |
| 1709 | return df |
| 1710 | |
| 1711 | |
| 1712 | def _get_slice(df,key,dim): |
no test coverage detected