When I use this code to import a data into Colab, it gives me the following error.
import pandas as pd
shirts = pd.read_csv(r"C:\Users\hp\Desktop\wine.data")
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\hp\\Desktop\\wine.data'
I cannot understand because the file is on my desktop!
Can someone help me?
Related
I wanted to plot a graph. but suddenly i could not because of the import error. yet i have installed matplotlib and numpy.
Traceback (most recent call last):
File "c:\Users\user\Documents\plot.py", line 1, in
from matplotlib import pyplot as plt
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib_init_.py", line 109, in
from . import _api, _version, cbook, docstring, rcsetup
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\rcsetup.py", line 27, in
from matplotlib.colors import Colormap, is_color_like
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\colors.py", line 56, in
from matplotlib import _api, cbook, scale
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\scale.py", line 23, in
from matplotlib.ticker import (
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\ticker.py", line 136, in
from matplotlib import transforms as mtransforms
File "C:\Users\user\AppData\Roaming\Python\Python311\site-packages\matplotlib\transforms.py", line 46, in
from matplotlib._path import (
ImportError: DLL load failed while importing _path: The specified module could not be found.
PS C:\Users\user\Documents>
I figured it out.
If you have already installed matplotlib, but the error still comes about. Then you have to download Microsoft C++ from their website.
https://www.microsoft.com/en-US/Download/confirmation.aspx?id=48145
install Microsoft c++ then you can try again to run your code.
it has worked for me like magic.
I got the solution from a youtube video.
link here.
https://www.youtube.com/watch?v=DpwsvUkNAmg
I was trying to read csv file in jupyter notebook but it showed error of filenotfound. Then I tried to check whether my file is present then it shoewd false as output. But I have checked the file location in my files explorer and the csv file is present .How should I read the file?
import os
os.path.isfile(r'C:\Users\Ritesh\Downloads\Data\Amazon_Products.csv')
Screenshot of code and error
maybe try:
import pandas as pd
df = pd.read_csv('your-filepath')
you could also try to move the file into your project directory so that it is in the same folder as the .ipynb
I'm trying to import a scikit-learn module
from sklearn.model_selection import train_test_split
and receive the error message
File "C:\Software\Anaconda\lib\site-packages\scipy\sparse\linalg\eigen\arpack\arpack.py", line 45, in <module>
from . import _arpack
ImportError: DLL load failed: The specified procedure could not be found.
I'm not the first person to encounter this issue
(Error when trying to import sklearn modules : ImportError: DLL load failed: The specified module could not be found)
but neither of the remedies suggested in that discussion
uninstall/reinstall scipy
modify the fixes.py file
solved my problem. Any new ideas would be appreciated.
I came across this interesting automl library, and was following this guide to run the module on Colab. In my Colab instance, I have this code:
!pip install automl_gs
import os
from automl_gs import automl_grid_search
from google.colab import files
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
automl_grid_search(csv_path='20190419.csv',
target_field='UpdatedSiteName',
model_name='tpu',
tpu_address = tpu_address)
and this results in the following error:
FileNotFoundError: [Errno 2] File b'tpu_train/metadata/results.csv' does not exist: b'tpu_train/metadata/results.csv'
I'm wondering if anyone on StackOverflow tried this automl_gs module on Colab and get it working. Based on the guide, it is supposed to create a folder tpu_* on its own, but it is creating the *results.csv file somewhere else as shown in the screenshot attached below.
.
Any tip/advice on how to overcome this would be greatly appreciated! Thank you.
I am trying to import pandas in an ipython (2.2.0, running python 3.3.5) notebook in my browser, which fails with
[...]
/usr/local/lib/python3.3/site-packages/numpy/add_newdocs.py in <module>()
11 from __future__ import division, absolute_import, print_function
12
---> 13 from numpy.lib import add_newdoc
14
15 ###############################################################################
/usr/local/lib/python3.3/site-packages/numpy/lib/__init__.py in <module>()
15 from .ufunclike import *
16
---> 17 from . import scimath as emath
18 from .polynomial import *
19 #import convertcode
ImportError: cannot import name scimath
However, in both pure python and non-notebook ipython, import pandas and the problematic line of from numpy.lib import add_newdoc run without a problem, and the file /usr/local/lib/python3.3/site/site-packages/numpy/lib/scimath.py exists and has the same permissions and creation date as the __init__.py in the same directory.
How do I debug this error? What does ipython notebook change about imports as compared to cli ipython?
See this previous question and answer - https://stackoverflow.com/a/15622021/1766755.
A key difference between the IPy notebook and CLI is the default behavior of the os.path var, as well as the notebook setting notebook_dir.
Obviously in the IPy notebook, pandas is not finding the scimath module. If you look closely at the traceback, you'll see the line
17 from . import scimath as math
This is a relative path import, the . signifying a request to import a module from the same directory. Depending on where the CLI is begun vs where you tell IPython to think it's running from, this could be the cause of numpy not finding scimath. I could be wrong, but it's happened to me before.