ModuleNotFoundError: No module named 'pandas.plotting._timeseries' - python

not very proficient yet in python and i'm trying to run :
import pyfolio as pf
pf.create_full_tear_sheet(portfolio.mean(axis=1))
(reference in the end of: https://blog.quantinsti.com/xgboost-python/)
in Anaconda/Spyder but get the
ModuleNotFoundError: No module named 'pandas.plotting._timeseries'
checked that pyfolio is installed and googled the error but didn't come across any solutions.
Would really appreciate some help.
tx!

It seems the pandas.plotting._timeseries module is only available for pandas versions before 0.25.x.
You can see the _timeseries module is present in 0.24.x
and is removed in 0.25.x (looks like the API changed to pandas.plotting._matplotlib.timeseries).
If you install an older version of pandas (anything before 0.25.x), it should work. Here's an example for last 0.24.x release:
pip install pandas==0.24.2

Related

Some issues with Python loading packages

I've been running into this same issue no matter what I do. I'm running Python on Spyder (custom python 3.7.9) and I keep getting errors when importing packages.
from pandas import dataframe
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import MinMaxScaler
The above are the modules in question which won't import. The errors I'm getting are:
ImportError: cannot import name 'dataframe' from 'pandas' (C:\Users\name\AppData\Local\Programs\Spyder\pkgs\pandas\__init__.py)
&
File "<ipython-input-8-4c3b6a7a4279>", line 1, in <module>
from sklearn.preprocessing import LabelEncoder
ModuleNotFoundError: No module named 'sklearn'
Using pip install <some package> doesn't seem to work either, even after resarting my Kernal. I tried to uninstall and reinstall and that doesn't work. Other modules in the ``pandaspackage import for me. Nothing fromsklearnseems to import. I even sepcified the exact location of the package inPYTHONPATH Managerand it still won't importsklearnandpandasdoesn't seem to have thedataframe``` module file included. I'm not sure how to ensure I get everything I need installed and imported.
EDIT: fixed the simple typo of dataframe instead of DataFrame. The main issue is now sklearn which has given me consistent issues across multiple scripts. setup.py method doesn't work, just keeps giving me the error that sklearn isn't found when trying to run the setup.
You must install miniconda if you are not using Spyder in Anaconda. You can then find out how to set this environment here: https://docs.spyder-ide.org/5/faq.html#using-packages-installer
You can install packages using conda install <some package> after setting the environment to the miniconda environment.

Keyczar: ModuleNotFoundError: No module named 'errors' in Python 3.8

I'm using django-encrypted-fields to encrypt models in the database, but I'm getting the ModuleNotFoundError: No module named 'errors' from keyczar, is there a solution?
I got the same ModuleNotFoundError: No module named 'errors' error when using python-keyczar.
In my case the error is from ... Python/3.9/lib/python/site-packages/keyczar/keyczar.py, line 26
This fails because the import errors statement on that line is using an "implicit relative import", which is not supported in python 3. You could fix this specific error by adding the keyczar directory to the PYTHONPATH so python can find this and the other modules that it imports in this way. But the real problem here is that you are using a python 2 module from python 3 and you'll run into other issues after fixing this one, because there are many other incompatibilities between between python 2 and 3.
There is a "python3-keyczar" keyczar module in pip (note the "3"). Using this module with python3 worked for me. So depending on your situation (I know nothing about django) the fix is using either python 2(.7) or uninstalling python-keyczar and installing python3-keyczar.
Note that keyczar is no longer maintained (see: https://github.com/google/keyczar)
python-keyczar
u installed this ??
check: pip list
or install
pip install python-keyczar

ImportError: cannot import name 'lzip'

A script I'm running is failing at one of my imports, and I can't figure out why.
The offending line of code is:
from pandas.compat import lzip
Error message: ImportError: cannot import name 'lzip'
This script is being run in a conda virtual environment, with dependencies installed through conda. Specific to this case, I have pandas and pandas-compat installed, also through conda, and running on Python3.6. (3.6 because 3.7 is incompatible with pandas-compat in an earlier attempt on a python3.7 env)
Help please, or point to where I may find the solution?
Not sure why lzip wouldn't be available, save for the warning at the top of the pandas API reference docu (Warning The pandas.core, pandas.compat, and pandas.util top-level modules are PRIVATE. Stable functionality in such modules is not guaranteed.). The first solution on this page didn't work for me.
Current pandas version: 0.25.3
Current pandas-compat: 0.1.1
Current python: 3.6.7

"No Module name matrix_factorization_utilities" found

I am a beginner in Machine Learning.
I am getting this error in my machine learning recommendation model "No Module name matrix_factorization_utilities" foundScreen Shot of error.
I am using Python 3 and Pycharm. Library numpy, pyMF pandas.
Looks like you don't have scipy
Windows:
python -m pip install scipy
Linux:
pip install scipy
It looks like you installed the module (as it is in your directory), so the next step is to make sure you the module is in your PYTHONPATH environment variable:
Python module not found
Here is another website that may also help regarding the PYTHONPATH variable:
How to fix "ImportError: No module named ..." error in Python?
Also APorter1031 raises an excellent point - that may be the issue.

why doesn't python 3.6.1 recognize numpy or pil or skimage after they have been successfully installed

I am getting these errors trying to run a python3 program in itelliJ IDEA on a mac.
import numpy as np
ModuleNotFoundError: No module named 'numpy'
from PIL import Image, ImageChops
ModuleNotFoundError: No module named 'PIL'
from skimage.feature import match_template # requires numpy, scipy, and six
ModuleNotFoundError: No module named 'skimage'
All of these modules have been successfully installed using pip3. I have confirmed the installs using IDLE. Clearly, it seems, there is more to it than simply installing, but I don't know what it is.
I cannot find anything that addresses concerns on python.org. They, in fact, refer me to Stackoverflow. The closest I found here dealt with numpy and python2.7 on mac. There are no responses to that one.
Look in the Preferences for the Project Interpreter setting, and make sure it's pointing to the right python version.
Secondly, since you're already using and IDE use PyCharm. It's IntelliJ's python specific IDE, and it'll have better documentation on python specific technical problems.

Categories

Resources