ImportError: No module named 'pandas'

Clash Royale CLAN TAG#URR8PPPImportError: No module named 'pandas'
I am trying to learn pandas and I haven't been able to import it into my code.
I have looked at other answers on this site and none of them have worked.
I just installed anaconda and installed everything through conda.
Here is a sample script that I am trying to run.
import pandas as pd
writer = pd.ExcelWriter('farm_data.xlsx', engine='xlsxwriter')
df.to_excel(writer, sheet_name='Sheet1')
workbook = writer.book
worksheet = writer.sheets['Sheet1']
chart = workbook.add_chart({'type': 'column'})
And the error it kicks back.
Traceback (most recent call last):
File "C:Usersthiet01DocumentsPython Scriptsnew 1.py", line 1, in
import pandas
ImportError: No module named 'pandas'
If you need any more information, please let me know and I can provide it.
Thanks in advance for any help.
You might have multiple Python installations in which case pandas is installed for one and not the other.
– bernie
Jun 27 '16 at 19:09
@VinceWest 1) Yes 2) I don't believe so. I installed anaconda, did some troubleshooting and tried restarting as I saw this reply (might have been you) in another thread. When I open a python shell, it doesnt say anything about continuum. Should I be looking elsewhere or how should I correct this?
– Tthieme
Jun 27 '16 at 19:17
@bernie How would I check this to see if I have multiple instances and where they are?
– Tthieme
Jun 27 '16 at 19:17
From your previous comment it sounds like you do have multiple installations. You can go to the Control Panel to Add/Remove Programs and uninstall the non-Anaconda Python.
– bernie
Jun 27 '16 at 19:19
6 Answers
6
I had the same problem for a long time. Today I tried a whole day and it finally worked. Below is the steps how I did it. I don't have theory for why the problem exist and how it is solved. I just know the following steps helped me get pandas going.
pandas
A. download first and install miniconda using the following code:
miniconda
bash Miniconda2-latest-MacOSX-x86_64.sh
B. create an env for your project using following code:
conda create --name trypandas numpy pandas jupyter
C. going to your env and try jupyter notebook with pandas using:
source activate trypandas
jupyter notebook
Note: my own experience indicates:
when I missed conda install jupyter, pandas only work in pure python environment, not in ipython nor in jupyter notebook;
conda install jupyter
after conda install jupyter, pandas works in jupyter notebook now.
conda install jupyter
pandas
jupyter notebook
the step B above installing jupyter together with numpy and pandas, there should not be a problem.
jupyter
numpy
pandas
Perfect worked great. Where is the trypandas installed?
– Stryker
Mar 1 '17 at 20:56
for my mac, it is installed in ~/miniconda2/envs hope it helps
– Daniel
Mar 2 '17 at 23:33
Perfect. Thanks
– Stryker
Mar 3 '17 at 14:34
below solved my issue:
apt-get install python3-pandas
or
apt-get install python2-pandas
Font: https://ask.fedoraproject.org/en/question/36529/installing-python-pandas/
Here is the basic documentation on how to instal python packages.
For OS and Linux users, the following command ought to work:
pip install pandas
I wanted to add this as a comment but Im not special enough yet in the eyes of stackoverflow.
Some modules need to be separately installed into your libraries folder of your python directory.Using pip (https://pip.pypa.io/en/stable/) is helpful for this. Otherwise manually add the module to your library folder by installing the module at:
https://pypi.python.org/pypi/pandas/0.18.1/
running the setup through the command line ((pandas location)>setup.py install), and finally adding it to your python directory.
Hope this helps!
Even I had same issue but this solved my problem-
sudo apt-get install python-pandas
sudo apt-get install python-pandas
To check if pandas is installed or not:
Open up a Python prompt by running the following:
python
python
At the prompt, type the following:
import pandas
print pandas.__version__
This will print the installed version of pandas in the system
What worked for me was to make sure that I run the command sudo apt-get so you run as root to make sure I download python3 like below
sudo apt-get
sudo apt-get install python3
The reason you need to use sudo it's because environments such as Ubuntu lock the root automatically according to Wikihow
sudo
Then I used
sudo apt-get update
sudo apt-get upgrade
And then I used the pip install pandas
pip install pandas
That worked for me. I hope that's helpful
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?
1) have you installed pandas: "conda install pandas". 2) is anaconda your default python, i.e. when you run "python" on the terminal, does it say the version indicating anaconda distribution
– Vince W.
Jun 27 '16 at 19:09