I'm trying to read in a regular csv file into pandas through pd.read_csv(). I have done this on my local desktop many times before but I am using a virtual machine now and am getting this error :
ImportError: cannot import name 'is_url' from 'pandas.io.common' (/opt/conda/lib/python3.7/site-packages/pandas/io/common.py)
Can anyone help me understand what's happening and how to resolve it? I have tried updating as well as uninstalling and reinstalling pandas already.
You now have a good sense of how useful pandas is when importing the CSV file, and conveniently, pandas offers other similar and equally handy functions to import Excel, SAS, and Stata files to name a few. Yet, due to the active community in open source software, there is constant activity in file formats and ways to import data.
The pandas read_csv () allows you to read a CSV file from a specific path. The root cause for this attributerror is that python is unable to interpret the read_csv () method. Suppose I will read the following lines of code then I will get the attributeerror: module ‘pandas’ has no attribute ‘read_csv’.
The pandas read_csv () allows you to read a CSV file from a specific path. The root cause for this attributerror is that python is unable to interpret the read_csv () method.
In pandas, columns with a string value are stored as type object by default. Because missing values in this dataset appear to be encoded as either 'no info' or '.', both string values, checking the data type for a column with missing values such as the fat column, you can see that its data type isn't ideal:
conda update --force-reinstall pandas
this worked for me.
I had the same problem. it showed up after I updated all the libraries with conda (trying to fix something else). After print the version of pandas inside the notebook, it showed as a really old one (0.3.somehing, can not remember the exact number). but strangely , my other notebook files were showing pandas version as 1.0.2, and i was able to load csv in those files without ImportError . So i went back to conda and upgraded pandas again just by itself, restarted conda, ran the code again , fixed it . Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With