我的观点:
library(tidyverse)
x %>%
spread(Gender, Salary) %>%
group_by(Department) %>%
summarise(`AvgSalaryWomen/Men` = mean(F)/mean(M),
`MedianSalaryWomen/Men` = median(F)/median(M))
# A tibble: 3 x 3
# Department `AvgSalaryWomen/Men` `MedianSalaryWomen/Men`
# <fctr> <dbl> <dbl>
# 1 Dep1 0.769 0.769
# 2 Dep2 1.27 1.27
# 3 Dep3 0.800 0.800 `
我的序列化程序更新:
class UserViewSet(SerializerByActionMixin, LoggingMixin, viewsets.ModelViewSet):
queryset = User.objects.all().order_by('-date_joined')
serializers = {
'default': UserSerializer,
'create': UserCreateSerializer,
'update': UserUpdateSerializer,
}
def get_permissions(self):
# allow non-authenticated user to create via POST
return (AllowAny() if self.request.method == 'POST'
else IsStaffOrTargetUser()),
VueJs的前端。 我对Vue不是很强,但是我的合作伙伴写道我无法将头像上传到文件系统,好吧,因为我知道前端的表格没有加载图像而且没有保存... 告诉我是否需要为头像编写单独的演示文稿和序列化程序,或者我没有添加一些方法?我在DRF方面不是很有经验? 谢谢!