'Excel_dataset' object has no attribute 'reshape'
时间: 2023-09-18 12:09:43 浏览: 122
The error message 'Excel_dataset' object has no attribute 'reshape' means that you are trying to use the 'reshape' method on an object of type 'Excel_dataset', but this object does not have this method.
The 'reshape' method is usually used on NumPy arrays to change their shape. If you are trying to reshape a NumPy array that is stored in your 'Excel_dataset' object, you will need to extract the array first and then perform the reshape operation on it.
Here's an example:
```python
import pandas as pd
import numpy as np
# Load data from Excel file
data = pd.read_excel('mydata.xlsx')
# Convert data to NumPy array
data_array = np.array(data)
# Reshape the array
reshaped_array = data_array.reshape((new_shape,))
```
If your 'Excel_dataset' object does not contain a NumPy array and you are still trying to use the 'reshape' method on it, you will need to check the documentation or the source code of the 'Excel_dataset' class to see what methods are available and how to use them.
阅读全文