小编Der*_*hew的帖子

如何修复 AttributeError:“Series”对象没有属性“append”

嗨,我仍在用 python 学习 pandas 和 numpy

我从电子学习中了解到,您可以将 2 个系列与附加结合起来,但是当我尝试它时,它给了我错误

students_classes = pd.Series({'Alice': 'Physics',
                   'Jack': 'Chemistry',
                   'Molly': 'English',
                   'Sam': 'History'})
students_classes

kelly_classes = pd.Series(['Philosophy', 'Arts', 'Math'], index=['Kelly', 'Kelly', 'Kelly'])
kelly_classes

all_students_classes = students_classes.append(kelly_classes)

all_students_classes
Run Code Online (Sandbox Code Playgroud)

它给了我这样的错误

AttributeError                            Traceback (most recent call last)
Cell In\[35\], line 3
1 # Finally, we can append all of the data in this new Series to the first using the .append()
2 # function.
\----\> 3 all_students_classes.str = students_classes.append(kelly_classes)
5 # This creates a series which has …
Run Code Online (Sandbox Code Playgroud)

attributes numpy append series pandas

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

append ×1

attributes ×1

numpy ×1

pandas ×1

series ×1