当我使用 Jupyter 笔记本时,它会向我显示在其他计算机上运行的代码的错误消息,这可能是什么问题?

问题描述 投票:0回答:1

我试过这个代码

cars = pd.series(["BMW", "Toyota", "Honda"])

它给了我这个错误消息

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[2], line 1
----> 1 series = pd.Series(["BMW", "Toyota", "Honda"])

AttributeError: module 'pandas' has no attribute 'series'

我尝试创造一系列汽车,如果我进入汽车,我希望获得该系列

python error-handling jupyter-notebook syntax-error attributeerror
1个回答
0
投票

使用Series代替系列。例如:

import pandas as PD
cars = pd.Series(["BMW", "Toyota", "Honda"])
print(cars)

输出

0       BMW
1    Toyota
2     Honda
dtype: object
© www.soinside.com 2019 - 2024. All rights reserved.