导入错误:没有名为 Pandas 的模块。安装了熊猫

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39091520/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 01:52:32  来源:igfitidea点击:

ImportError: No module named pandas. Pandas installed

pythonmacospandasanaconda

提问by salty_coffee

I am pretty new to programming and am having issues importing pandas to my program. Hoping someone could point me in the right direction to fix this. I am running OSX

我对编程很陌生,并且在将Pandas导入我的程序时遇到了问题。希望有人能指出我正确的方向来解决这个问题。我正在运行 OSX

regresson.py

回归.py

import pandas as pd
import Quandl

df = Quandl.get('WIKI/GOOGL')
print df.head

and am getting the error:

并收到错误:

import pandas as pd
ImportError: No module named panda

I have anaconda on my system.

我的系统上有 anaconda。

Pandas 0.17.1

Pandas 0.17.1

Numpy 1.11.1

麻木 1.11.1

Scipy 0.18.0

Scipy 0.18.0

Pytz 2016.6.1

派兹 2016.6.1

回答by Julian

make sure to activate your conda environment

确保激活您的 conda 环境

in your terminal-

在您的终端中-

conda create -n environment_name quandl pandas
cd path_to_env 
activate environment_name 
(environment_name)conda list (make sure u have the right packages)
(environment_name) your_program.py

回答by Josh Anish

 # if using pip 
 pip install pandas
 # if using anaconda
 conda install pandas
 #after this step use
 condo update -all

回答by melihozbek

Python imports, and the language itself, is case sensitive. This means that after you fix the pandas installation, you'll also need

Python 导入和语言本身区分大小写。这意味着在您修复Pandas安装后,您还需要

import quandl

and not

并不是

import Quandl

On another note, it's worth noting that we usually call df.head(), not df.head. This way, when working on a Jupyter notebook, as an example, the formatting is nicer. Also you can specify the number of first rows you want to see, such as df.head(10).

另一方面,值得注意的是,我们通常调用df.head(),而不是df.head。这样,例如,在使用 Jupyter 笔记本时,格式会更好。您也可以指定要查看的第一行数,例如df.head(10).