ImportError: cannot import name 'Categorical' from 'pandas.core.arrays' (unknown location) - pandas

Whenever i am trying to import pandas as pd
it showing
ImportError: cannot import name 'Categorical' from 'pandas.core.arrays' (unknown location)

pip install pandas
import pandas as pd # pandas version 1.3.5
it work on python version 3.7.14

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

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

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

ImportError: cannot import name 'Flags' from 'pandas'

I ran into the below when trying to import pandas from modin on mac os
import modin.pandas as pd. what is the possible fix for this?
error traceback
ImportError Traceback (most recent call last)
<ipython-input-44-7e7b44bd7fd7> in <module>
----> 1 import modin.pandas as pd
~/opt/anaconda3/lib/python3.8/site-packages/modin/pandas/__init__.py in <module>
26 )
27
---> 28 from pandas import (
29 eval,
30 cut,
ImportError: cannot import name 'Flags' from 'pandas' (/Users/mac/opt/anaconda3/lib/python3.8/site-packages/pandas/__init__.py)
Probably, pandas version that you use is old enough. Flags appeared in pandas since 1.2.1 version. In order to get the latest versions of Modin and pandas, you can do the following:
pip uninstall modin # this removes Modin and its dependencies
pip install modin # this installs Modin 0.9.1 with pandas 1.2.3

ModuleNotFoundError: No module named 'geo'

I am using the following libraries:
import pandas as pd
import numpy as np
import googlemaps
from geopy.geocoders import Nominatim
import sys
from dateutil import parser
from geo import *
import re
I already installed in the prompt:
pip install GoogleMaps
pip install geopy
pip install geopandas
conda install -c conda-forge geopandas
However, I am still having the following error:
> ModuleNotFoundError Traceback (most recent call
> last) <ipython-input-1-456abdb5bc33> in <module>
> 5 import sys
> 6 from dateutil import parser
> ----> 7 from geo import *
> 8 import re
ModuleNotFoundError: No module named 'geo'
I really appreciate any help to solve this error
Have you tried
pip install geo-py
?
https://pypi.org/project/geo-py/

ImportError: cannot import name 'VirtualDeviceConfiguration' from 'tensorflow.python.eager.context'

Getting import error while trying to download fashion_mnist data
Below is the script that I used in spyder.
from tensorflow.keras.datasets import fashion_mnist
Tensorflow version
Name: tensorflow
Version: 2.1.0