简体   繁体   中英

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)

i try to run the pd.series it is giving me this error:

---------------------------------------------------------------------------
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

The right syntax would be:

import pandas as pd

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM