簡體   English   中英

Object `pd.series` 未找到

[英]Object `pd.series` not found

i have installed pandas in anaconda 3, i try to run my first pandas code on anaconda and it is showing me error, this is an example of the code i run

import pandas as pd
  pd.series?

fruits = ['mango', 'orange', 'lemon' ]
  pd.series(fruits)

我嘗試運行 pd.series 它給了我這個錯誤:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-9-efbecfd378d2> in <module>
  1 fruits = ['mango', 'orange', 'lemon' ]
 ----> 2 pd.series(fruits)

~\anaconda3\lib\site-packages\pandas\__init__.py in __getattr__(name)
261             return _SparseArray
262 
--> 263         raise AttributeError(f"module 'pandas' has no attribute '{name}'")
264 
265 

AttributeError: module 'pandas' has no attribute 'series

正確的語法是:

import pandas as pd

fruits = ['mango', 'orange', 'lemon' ]
pd.Series(fruits)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM