嗨,我仍在用 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)