AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?
时间: 2023-09-29 07:03:23 浏览: 56
This error occurs because the `DataFrame` object in pandas does not have an `append` method. Instead, you can use the `concat` method to concatenate two or more dataframes vertically. Here is an example:
```python
import pandas as pd
# create two dataframes
df1 = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
df2 = pd.DataFrame({'A': [7, 8, 9], 'B': [10, 11, 12]})
# concatenate vertically
df_combined = pd.concat([df1, df2])
print(df_combined)
```
This will output:
```
A B
0 1 4
1 2 5
2 3 6
0 7 10
1 8 11
2 9 12
```
Note that the index of the resulting dataframe is not reset. If you want to reset the index, you can add the `ignore_index=True` parameter to the `concat` method.