ANACONDA "ModuleNotFoundError: No module named 'pandas.tslib'" in pandas python - pandas

I would like to run below code but I received an error in my anaconda environment. How can I solve this issue in Anaconda? Please help!
Thank you.
import pandas as pd
import numpy as np
from statsmodels.tools.eval_measures import rmse, aic
from darts import TimeSeries
from darts.utils.timeseries_generation import gaussian_timeseries, linear_timeseries
from darts.models import RNNModel, TCNModel, TransformerModel, NBEATSModel, BlockRNNModel
from darts.metrics import mape, smape
from darts.utils.timeseries_generation import datetime_attribute_timeseries
After I tried
conda uninstall pandas
conda install pandas
Error message becomes :

Check the corresponding path, if you do not find pandas._libs.tslib module then you would have to uninstall pandas and reinstall again.
conda uninstall pandas
conda install pandas
You can also check if the version of pandas you are using is consistent with the version of python

Related

pandas and matplotlib not found on my tensorflow conda environment

I use a MacBook pro-2015, and I use the monetary.
I was able to pip install tensorflow to a new conda environment, but after it, pandas and matplotlib was no longer found.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
import pandas as pd
Below is the traceback of error:
ModuleNotFoundError Traceback (most recent call last)
Cell In[1], line 2
1 import numpy as np
----> 2 import matplotlib.pyplot as plt
3 import tensorflow as tf
4 import pandas as pd
ModuleNotFoundError: No module named 'matplotlib'
I have been able to solve this problem
I created a conda environment "myenv" where I installed tensorflow
Then I activated the conda environment in my terminal using
conda activate myenv
Then I installed the packages/libraries that I need
conda install pandas
conda install matplotlib
Just use this method to install any package into any environment you are working on

Cannot import name 'to_html' from 'pandas_profiling.report' using JupyterLab

I'm new using Jupyter Lab and Pandas profiling.
I'm trying to install and import and install Pandas Profiling in a jupyter notebook. I'm able to install pandas collab using pip, but unable to import the library. The error says I cannot import name 'to_html' from 'pandas_profiling.report'.
Here's the code and the error.
Funny thing is: I also tried to run the notebook in Google Colab, but I got a different but similar error:
ImportError: cannot import name 'PandasProfiling' from 'pandas_profiling' (/usr/local/lib/python3.8/dist-packages/pandas_profiling/__init__.py)
I already tried to use Jupyter Lab and Jupyter Notebook from Anaconda and Google Colab to see if it works, but no look.
conda install -c conda-forge pandas-profiling
See this question.
from pandas_profiling import ProfileReport
https://pandas-profiling.ydata.ai/docs/master/pages/getting_started/quickstart.html
PandasProfiling object does not exist.

cannot import name 'Appender' from 'statsmodels.compat.pandas' in google colab error?

I am trying to import from pmdarima.arima import auto_arima and
from pmdarima.arima import ADFTest but it giving me error cannot import name 'Appender' from 'statsmodels.compat.pandas'
I tried !pip install pmdarima in google colab but it is still giving me error
I had the same and fixed it by downgrading scipy
pip install pmdarima scipy==1.2 -Uqq
got it from How to fix Google colab import errors on statsmodels logsumexp and factorial
A restart of the runtime environment was needed after installation.

cannot import name 'animation' from 'matplotlib'

I try import matplotlib with:
import matplotlib.pyplot as plt
But I get this error:
ImportError: cannot import name 'animation' from 'matplotlib' (C:\Users\David\AppData\Roaming\Python\Python37\site-packages\matplotlib_init_.py).
I removed and reinstalled matplotlib, I tried installing older matplotlib version.
In my case, updating matplotlib and restarting the kernel (in Jupyter notebook) solved the issue.
I installed this version:
pip install --user matplotlib==3.5.0b1
I realise this question is 10 months old now.
Hope it helps other users.

pandas_profiling.ProfileReport(dataframe) in google colab

Why doesn't pandas_profiling.ProfileReport(dataframe) work in google colab?
Returns a type error.
TypeError: concat() got an unexpected keyword argument 'join_axes'
Just use pandas-profiling version 2.7.1 and you are good to go.Run this command in the colab !pip install pandas-profiling==2.7.1
Aishah Ismail's post on Medium may help you fix this issue.
Install the pandas-profiling package using pip.
! pip install https://github.com/pandas-profiling/pandas-profiling/archive/master.zip
Restart your kernel = Go to "Runtime" in the option menu and click "Reset All Runtimes"
Execute your code to create your dataframe and create the pandas profile.
import pandas as pd
import numpy as np
from pandas_profiling import ProfileReport
df = pd.read_excel('fileName.xlsx')
profile = ProfileReport(df)
profile.to_notebook_iframe()
You may need to pip install pandas-profiling if the import above does not work.
!pip install pandas-profiling==2.7.1 Re-execute your code after the pip install.
When you try to display the profile do not use .to_widgets()--it isn't working in Colab.
If the above doesn't work, I suggest switching to Jupyter Lab or Jupyter Notebook. The pandas profile dashboard works well in the Jupyter environment.
I hope this helps! Pandas-Profiling a wonderful EDA tool--such a time saver.