1 2D轉換爲1D
TypeError(“expected 1D vector for x”)
x
是一個數據框,其值爲2D:
x.shape
(546, 1)
flatten()
將其轉換爲一維數組:
x.flatten().shape
(546,)
1 2D轉換爲1D
TypeError(“expected 1D vector for x”)
x
是一個數據框,其值爲2D:
x.shape
(546, 1)
flatten()
將其轉換爲一維數組:
x.flatten().shape
(546,)
1.while循環的格式 while 條件: 條件滿足時,做的事情1 條件滿足時,做的事情2 條件滿足時,做的事情3 ...(省略)... demo