如何获取大熊猫中连续值的比例?

时间:2020-11-04 13:14:15

标签: python pandas sum row average

假设我有以下df:

pass = ""

,我想按行显示值的比例,所以如下所示:

pass = "myPassword"

到目前为止,我的主要问题是如何获取行的总和:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("B14:B50")) Is Nothing Then
        Dim pass As String
        pass = "" 'set the password. Otherwise, protection/unprotection is done without a pass
        If Target.Cells.Count > 1 Then Exit Sub
        ActiveSheet.Unprotect pass
        If Target.Value = "locked" Then
            Target.Offset(0, 1).Locked = True
        ElseIf Target.Value = "notlocked" Then
            Target.Offset(0, 1).Locked = True
        End If
        ActiveSheet.Protect pass
    End If
End Sub

其中(XXX)应该是给定行的总和

1 个答案:

答案 0 :(得分:4)

尝试将[?direction=='Inbound'].[access,sourceAddressPrefixes]div

sum