type object 'QCompleter' has no attribute 'FilterMode'. Did you mean: 'filterMode'? 在pyqt6中提示错误
时间: 2023-06-21 20:20:28 浏览: 34
对不起,我犯了一个错误。在PyQt6中,QCompleter的过滤模式属性应该是`filterMode`而不是`FilterMode`。因此,正确的代码应该是:
```python
completer.setFilterMode(QCompleter.filterMode().Contains)
```
我深表歉意,希望这次能够回答您的问题。
相关问题
AttributeError: DataFrame object has no attribute append . Did you mean: _append ?
This error occurs when you try to call the `append` method on a Pandas DataFrame object, but the object does not have an `append` attribute.
One possible reason for this error is that you are trying to append a DataFrame to another DataFrame using the `append` method, but you are not using it correctly. In Pandas, the `append` method does not modify the original DataFrame, but instead it returns a new DataFrame that contains the rows from both DataFrames. Therefore, you need to assign the result of the `append` method to a new variable or to the original DataFrame, like this:
```
df1 = pd.DataFrame({'A': [1, 2], 'B': [3, 4]})
df2 = pd.DataFrame({'A': [5, 6], 'B': [7, 8]})
df3 = df1.append(df2)
```
In this example, `df3` will contain the rows from both `df1` and `df2`.
If you are still getting the AttributeError, it's possible that the DataFrame object you are trying to append to does not have an `append` attribute. In this case, you can try using the `_append` attribute instead, which is a private method that is used internally by Pandas. However, be aware that using private methods may not be supported in future versions of Pandas and may cause unexpected behavior.
```
df1._append(df2)
```
'Series' object has no attribute 'reshape'. Did you mean: 'shape'?
当你在使用pandas的Series对象进行reshape操作时,你会遇到错误提示"'Series' object has no attribute 'reshape'. Did you mean: 'shape'?"。这是因为pandas的Series对象没有reshape方法。解决这个问题的方法是将Series对象转化成numpy的ndarray,然后再使用ndarray的reshape方法。
以下是两种解决方案:
1. 使用values方法将Series对象转化成numpy的ndarray,然后使用ndarray的reshape方法。
```python
import pandas as pd
import numpy as np
landmarks_frame = pd.read_csv('faces/face_landmarks.csv')
landmarks = landmarks_frame.iloc[65, 1:]
landmarks = landmarks.astype('float').values.reshape(-1, 2)
```
2. 使用to_numpy方法将Series对象转化成numpy的ndarray,然后使用ndarray的reshape方法。
```python
import pandas as pd
import numpy as np
landmarks_frame = pd.read_csv('faces/face_landmarks.csv')
landmarks = landmarks_frame.iloc[65, 1:]
landmarks = landmarks.astype('float').to_numpy().reshape(-1, 2)
```