'numpy.ndarray' object has no attribute 'head'
时间: 2023-09-27 21:08:40 浏览: 179
将numpy.ndarray格式图像转化为_io.BufferedReader格式
The 'numpy.ndarray' object does not have a 'head' attribute because it is not a pandas DataFrame or Series object. The 'head' method is a pandas method that returns the first n rows of a DataFrame or Series object. If you're working with a numpy ndarray object and you want to see the first few rows, you can use the slicing operator to select the first n rows. For example, to get the first 5 rows of a 2D ndarray called 'arr', you can use:
```
arr[:5, :]
```
If you want to get the first 5 elements of a 1D ndarray called 'arr', you can use:
```
arr[:5]
```
阅读全文