MCPcopy Create free account
hub / github.com/NatLabRockies/windtools / _get_pivot_table

Function _get_pivot_table

windtools/plotting.py:1696–1709  ·  view source on GitHub ↗

Return pivot table with given fieldnames as columns

(df,dim,fieldnames)

Source from the content-addressed store, hash-verified

1694
1695
1696def _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
1712def _get_slice(df,key,dim):

Callers 3

plot_timeheightFunction · 0.85
plot_profileFunction · 0.85

Calls 1

_get_dimFunction · 0.85

Tested by

no test coverage detected