我對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