pandas.Series轉numpy的n維數組
一、總結
一句話總結:
可以直接用np的array方法
二、pandas.Series轉numpy的n維數組
博客對應課程的視頻位置:
print(test_y)
171 14.5 172 7.6 173 11.7 174 11.5 175 27.0 176 20.2 177 11.7 178 11.8 179 12.6 180 10.5 181 12.2 182 8.7 183 26.2 184 17.6 185 22.6 186 10.3 187 17.3 188 15.9 189 6.7 190 10.8 191 9.9 192 5.9 193 19.6 194 17.3 195 7.6 196 9.7 197 12.8 198 25.5 199 13.4 Name: sales, dtype: float64
type(test_y) 結果
pandas.core.series.Series
pandas.Series轉numpy的n維數組
可以直接用np的array方法
import numpy as np
np.array(test_y)
array([14.5, 7.6, 11.7, 11.5, 27. , 20.2, 11.7, 11.8, 12.6, 10.5, 12.2, 8.7, 26.2, 17.6, 22.6, 10.3, 17.3, 15.9, 6.7, 10.8, 9.9, 5.9, 19.6, 17.3, 7.6, 9.7, 12.8, 25.5, 13.4])