'DataFrame' object has no attribute 'append'. Did you mean: '_append'?
时间: 2023-06-23 08:54:20 浏览: 170
Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
5星 · 资源好评率100%
This error message indicates that you are trying to use the "append" method on a Pandas DataFrame object, but this method does not exist. Instead, you can use the "concat" method to append one DataFrame to another. Here is an example:
```
import pandas as pd
# create two DataFrames
df1 = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]})
df2 = pd.DataFrame({'A': [4, 5, 6], 'B': [7, 8, 9]})
# append df2 to df1
df_concat = pd.concat([df1, df2])
```
In this example, the "concat" method is used to append the "df2" DataFrame to the "df1" DataFrame, and the result is stored in a new DataFrame called "df_concat".
阅读全文