如何在使用Miniconda安装pandas后将pandas导入为pd

时间:2017-06-15 03:13:48

标签: python-3.x pandas miniconda

bash Miniconda3-latest-MacOSX-x86_64.sh #installed miniconda on Mac   

conda create -n name_of_my_env python=3.6 #created an environment with python 3.6 

source activate name_of_my_env# activate enviroment

conda install pandas #install pandas by condan

在python中打开空闲并尝试通过传递值列表来创建一个Series,让pandas创建一个adefault整数索引:

       import pandas as pd  
       import numpy as np  
       import matplotlib.pyplot as plt 
       s = pd.Series([1,3,5,np.nan,6,8])  print (s)

       Below is error message:
       ModuleNotFoundError: No module named 'pandas'

3 个答案:

答案 0 :(得分:1)

你能做一个

吗?
conda install ipython
你安装大熊猫后

?之后,输入ipython并执行代码以查看其进展情况。

如果您使用空闲,请尝试:

conda install idle

然后打开idel来运行你的代码。

答案 1 :(得分:0)

bash Miniconda3-latest-MacOSX-x86_64.sh#在Mac上安装miniconda

conda create -n dog python = 3.6 #created an environment / name dog

source activate dog#activate dog enviroment

conda install pandas = 0.20.2 #install pandas(0.20.2版本)by condan

conda install conpan安装matplotlib #install matplotlib

conda install jupyter notebook

jupter notebook #将URL复制/粘贴到浏览器中以打开jupyter笔记本

   import pandas as pd  
   import numpy as np  
   import matplotlib.pyplot as plt   
   s = pd.Series([1,3,5,np.nan,6,8])  
   print (s)

   0    1.0
   1    3.0
   2    5.0
   3    NaN 
   4    6.0
   5    8.0
   dtype: float64

答案 2 :(得分:-1)

您的闲置和熊猫很可能安装在不同的虚拟环境中。

激活您的虚拟环境

source activate name_of_my_env

安装idle / ipython或jupyter notebooks

从虚拟环境中启动空闲/笔记本。

现在检查您是否能够导入pandas