ImportError: No module named pandas. Pandas installed - python

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
regresson.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.
Pandas 0.17.1
Numpy 1.11.1
Scipy 0.18.0
Pytz 2016.6.1

make sure to activate your conda environment
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

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

Python imports, and the language itself, is case sensitive. This means that after you fix the pandas installation, you'll also need
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).

Related

importing qmc as submodule in scipy

When I write from scipy.stats import qmc I face Import Error in Jupyter notebook:
ImportError: cannot import name 'qmc' from 'scipy.stats' (C:\winapps\Anaconda3\lib\site-packages\scipy\stats\__init__.py)
I want to do Halton sampling, how can I solve this problem?
The qmc module was added in version 1.7.0 of scipy (around July 2021). You probably need to update the package. Since you are using Anaconda, you can use:
conda install scipy=1.7
Although this might break you base environment. Instead, you would better off creating a new environment using conda:
conda create -n myenv scipy=1.7 pandas ipykernel

ImportError: cannot import name 'DtypeArg' from 'pandas

I'm using Pandas 1.3.2 in a Conda environment.
When importing pandas on a Jupyter Notebook:
import pandas as pd
I get the error:
ImportError: cannot import name 'DtypeArg' from 'pandas._typing' (C:\Users\tone_\anaconda3\envs\spyder\lib\site-packages\pandas\_typing.py)
I've seen similar questions, but so far no solution.
Can anyone help?
It worked with me when I downgraded the pandas from panadas=1.3.5 to pandas=1.3.0 and I am using conda enviroment
According to the answer provided in this post it is a bug in pandas==1.3.1.
A possible solution is to downgrade it to some earlier version, e.g pip install pandas==1.3.0

modulenotfounderror no module named 'modin'

I have created a virtual environment with following syntax in the windows terminal:
conda create --prefix ./modinenv python=3.6 numpy
conda activate e:\modin\modinenv
pip install modin[dask]
jupyter notebook
In a new python file, when i executed this following command:
import modin.pandas as pd
it gives me an error: modulenotfounderror no module named 'modin'
I searched many forum, but got no workable response to this.
I even tried following before import statement:
import os
os.environ["MODIN_ENGINE"] = "dask" # Modin will use Dask
import modin.pandas as pd
This also does not work here. So any help in this regard is appreciated.
Thanks
Gopinath
I have exactly the same environment setting as you.
import os
import modin.pandas as pd
os.environ["MODIN_ENGINE"] = "dask"
Try following:
It seems that your Modin may not install properly, so please try pip install -U modin according to Modin documentation
pip3 install 'modin[dask]'

ModuleNotFoundError: No module named 'pycountry' even though it is installed

I got this error from python ModuleNotFoundError: No module named 'pycountry'.
I imported the module using pip and pip3 and I've also tried running my code in terminal using python, python3, and IDLE.
Why doesn't python recognize the module? I'm receiving the same error about plotly and pandas as well.
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csvā€© '
df1 = pd.read_csv(URL_DATASET)
list_countries = df1['Country'].unique().tolist()
d_country_code = {}
Open your command window and then use this code there.
pip install pycountry
This will install the whole package in your system, so whenever you import the module, it will not show an error.
This worked for me, I was facing the same issue while using it in Jupyter Notebook.
If you want more information please visit this page.
If you have Anaconda, try:
conda install -c conda-forge pycountry

Quandl is not being imported

I'm getting started for Machine learning using Python and would like to use Quandl for computing. I installed the Quandl using pip install Quandl and also, pandas using pip install pandas. Later, the import for pandas is successful, but, I couldn't import quandl. I get error as following,
`ImportError: No module named Quandl`
I use Python 2.7 and Quandl supports both 2 and 3 version of Python. How to do the import properly ?
Looking at the docs, it is lower case:
import quandl

Categories

Resources