为什么cmp(unicode,np.int64)会因UnicodeDecodeError而失败?

时间:2018-03-09 03:58:18

标签: python numpy

为什么会以这种方式失败:

PS> Get-WmiObject -List -Class *shadow*


   NameSpace: ROOT\cimv2

Name                                Methods              Properties
----                                -------              ----------
Win32_ShadowProvider                {}                   {Caption, CLSID, Description, ID...}
Win32_ShadowCopy                    {Create, Revert}     {Caption, ClientAccessible, Count, Description...}
Win32_ShadowContext                 {}                   {Caption, ClientAccessible, Description, Differential...}
Win32_ShadowStorage                 {Create}             {AllocatedSpace, DiffVolume, MaxSpace, UsedSpace...}
Win32_ShadowVolumeSupport           {}                   {Antecedent, Dependent}
Win32_ShadowFor                     {}                   {Antecedent, Dependent}
Win32_ShadowOn                      {}                   {Antecedent, Dependent}
Win32_ShadowBy                      {}                   {Antecedent, Dependent}
Win32_ShadowDiffVolumeSupport       {}                   {Antecedent, Dependent}

虽然成功了:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Intersect(Target, Range("A:F")) Is Nothing Then
        On Error GoTo meh
        Application.EnableEvents = False
        Dim t As Range, tr As Long, v As Long
        For Each t In Intersect(Target, Range("A:F"))
            tr = t.Row
            If Cells(tr, "B").Value2 <> vbNullString And _
              Application.Count(Range(Cells(tr, "A"), Cells(tr, "F"))) = 5 Then
                Cells(tr, "A").Offset(0, 7) = Cells(tr, "A").Value
                Cells(tr, "B").Offset(0, 7) = Cells(tr, "B").Value & " - A"
                For v = 3 To 6
                    Select Case Cells(tr, v).Value
                        Case Is < 25
                            Cells(tr, v).Offset(0, 7) = 25
                        Case Is < 50
                            Cells(tr, v).Offset(0, 7) = 50
                        Case Is < 75
                            Cells(tr, v).Offset(0, 7) = 75
                        Case Else
                            Cells(tr, v).Offset(0, 7) = 100
                    End Select
                Next v
            End If
        Next t
    End If

meh:
    Application.EnableEvents = True
End Sub

我试图对包含混合类型的pandas数据帧进行分组时遇到了这个问题。

(python 2.7)

0 个答案:

没有答案