文章目录
【当前pandas版本】
pip show pandas
执行脚本:
ss1 = pd.Series({'a':10,'b':20})
s2 = ss1.append(ss1)
s2['c'] = 40
print(s2)
报错,转换为DataFrame依然报错:
‘DataFrame’ object has no attribute ‘append’
‘Series’ object has no attribute ‘append’
**【修改】
不需要改pandas的版本!
只需要将append()
改为_append()
即可!**
ss1 = pd.Series({'a':10,'b':20})
s2 = ss1._append(ss1)
s2['c'] = 40
print(s2)