我对3个变量(position,offer,group)作了crosstab。我怎样才能通过总计1个变量offer来计算百分比,而不是利润率(即按列来标准化)? df = pd.crosstab(df.group, [df.position, df.offer], margins = True)
DF pid offer position group
1 accept left group
我有R中的下面的代码是从here改性,其绘出一个交叉表: #load ggplot2
library(ggplot2)
# Set up the vectors
xaxis <- c("A", "B")
yaxis <- c("A","B")
# Create the data frame
df <- expand.grid(xaxis, yaxis)
d