熊猫的get_dummies由于存在看不见的数据问题

时间:2018-11-08 23:40:38

标签: python pandas scikit-learn

我正遇到ValueError问题:y包含新标签:xxxx。我在这里找到了解决方案:sklearn.LabelEncoder with never seen before values。但是我不确定如何将sklearn转换为pd.get_dummies?

这是我的代码

multisheetArray.Type1Var.Type2Var.Type3Var

这是我的虚拟数据:

Sub Test3DArray()
Dim w As Long, x As Long, y As Long, z As Long
    Dim c As Range
    Dim v As Variant
    Dim multiSheetArray(11, 7, 3) As Variant    'array with 3 sheets, 5 columns/rows
With Worksheets("Sheet1")
'start at Cells(10,4)
Dim startingRow, startingColumn, staggeredYears As Integer
startingRow = 10
startingColumn = 4
staggeredYears = 3
For w = 0 To 10

    For x = 0 To 6
        For y = 0 To 2
            multiSheetArray(w, x, y) = .Cells(x + startingRow, y + startingColumn + (w * staggeredYears))
        Next
    Next
Next
End With

End Sub

0 个答案:

没有答案