Error in VS code while importing pandas for python - python

So I have installed pandas via cmd. But when I tried importing it in the VS code, some unrecognizable error has occurred. I installed the numpy using the same procedure and it worked all right as I performed various codes using that. So I'm not sure what exactly this error means. Some of the keywords like genfromtxt, delimiter etc were used in the previous file that I made using numpy.
Code:
import pandas as pd
ds= pd.Series([2, 4, 6, 8, 10])
print(ds)
Error:
Traceback (most recent call last):
File "c:\Users\Pranami Gajjar\pyCodes\pract_26.py", line 1, in <module>
import pandas as pd
File "C:\Users\Pranami Gajjar\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas_init__.py", line 50, in <module>
from pandas. .core.api import (
File "C:\Users\Pranami Gajjar\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\api.py", line 29, in <module>
from pandas.core.arrays import Categorical
File "C:\Users\Pranami Gajjar\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\arrays init__.py", line 7, in <module>
from pandas.core.arrays.categorical import Categorical
File "C:\Users\Pranami Gajjar\AppData\Local\Programs\Python\Python39\lib\site-packages\pandas\core\arrays\categorical.py", line 3, in <module>
from csv import QUOTE NONNUMERIC
File "c:\Users\Pranami Gajjar\pyCodes\csv.py", line 2, in <module>
data= genfromtxt("Python.csv', delimeter=',, skip_header=1)
TypeError: genfromtxt() got an unexpected keyword argument 'delimeter'

Related

How can I fix a Ratcave Import Error, how can I avoid issues like this in the future?

I just installed Ratcave yesterday, and have been trying all day to get it to work. My test file is a file that only contains:
import ratcave
It throws the same error no matter what I do:
Traceback (most recent call last):
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\Test.py", line 2, in <module>
import ratcave as rc
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\ratcave\__init__.py", line 5, in <module>
from . import resources
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\ratcave\resources.py", line 5, in <module>
from .camera import Camera
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\ratcave\camera.py", line 4, in <module>
from .physical import PhysicalGraph
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\ratcave\physical.py", line 4, in <module>
from . import coordinates
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\ratcave\coordinates.py", line 6, in <module>
from scipy.spatial.transform import Rotation as R
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\scipy\spatial\__init__.py", line 105, in <module>
from ._kdtree import *
File "C:\Users\drvlw\AppData\Local\Programs\Python\Python310\lib\site-packages\scipy\spatial\_kdtree.py", line 4, in <module>
from ._ckdtree import cKDTree, cKDTreeNode
File "_ckdtree.pyx", line 1, in init scipy.spatial._ckdtree
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
How can I fix this?
I have tried uninstalling and reinstalling and some other things but everytime I run the file it does the same thing.

Python - ValueError: source code string cannot contain null bytes

I have a problem. I am using Windows 7 32x, Python 3.
When I try to import the numpy library in code, no matter what, I get an error. I don't remember how to solve it.
The code itself:
import numba
print('Hello World!')
And here is the error:
Traceback (most recent call last):
File "C:\Users\User\Desktop\numba_test.py", line 1, in <module>
import numba
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\__init__.py", line 38, in <module>
from numba.core.decorators import (cfunc, generated_jit, jit, njit, stencil,
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\decorators.py", line 12, in <module>
from numba.stencils.stencil import stencil
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\stencils\stencil.py", line 11, in <module>
from numba.core import types, typing, utils, ir, config, ir_utils, registry
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\registry.py", line 4, in <module>
from numba.core import utils, typing, dispatcher, cpu
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\dispatcher.py", line 13, in <module>
from numba.core import (
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\compiler.py", line 6, in <module>
from numba.core import (utils, errors, typing, interpreter, bytecode, postproc,
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\cpu.py", line 15, in <module>
import numba.core.entrypoints
File "C:\Users\User\AppData\Roaming\Python\Python37\site-packages\numba\core\entrypoints.py", line 8, in <module>
import importlib_metadata
ValueError: source code string cannot contain null bytes
I have reinstalled numba several times, searched for solutions on the Internet, but all without success. Help what you can.
import numbers
print('Hello World!')

Pandas import error with python 2.7

I'm creating a very simple Python program which imports ExxonMobil's stock price between two data from Google Finance.
Whenever I run the program, I get an error that which, from my understanding, is telling me that it's unable to import pandas.
Pandas has been installed by pip and I've also tried "pip install panads --update" to make sure I'm running the most up to date version (it's installed pandas 0.21.0). Same with pandas-datareader but still no luck. What I'd expect to see is that it prints out the first 5 rows of data.
I'm running Python 2.7 and it's in a virtualenv.
Thanks for any help in advance and the code is below:
import datetime
import pandas
from pandas_datareader import data
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime(2015, 8, 22)
df = data.DataReader("XOM", "google", start, end)
print df.head()
Error output:
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/lcc/virtualenv/matplotlib/pandas.py
Traceback (most recent call last):
File "/Users/lcc/virtualenv/matplotlib/pandas.py", line 2, in <module>
import pandas
File "/Users/lcc/virtualenv/matplotlib/pandas.py", line 3, in <module>
from pandas_datareader import data
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/__init__.py", line 3, in <module>
from .data import (get_components_yahoo, get_data_famafrench, get_data_google, get_data_yahoo, get_data_enigma, # noqa
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/data.py", line 7, in <module>
from pandas_datareader.google.daily import GoogleDailyReader
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/google/daily.py", line 1, in <module>
from pandas_datareader.base import _DailyBaseReader
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/base.py", line 7, in <module>
import pandas.compat as compat
ImportError: No module named compat
Process finished with exit code 1
Check what is written in the error traceback:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas_datareader/base.py", line 7, in <module>
import pandas.compat as compat
pandas_datareader/base.py calls (imports) pandas.compat
you named your script pandas.py - that has shadowed the Pandas module and your script doesn't contain compat.
Solution:
Rename /Users/lcc/virtualenv/matplotlib/pandas.py to something that does NOT duplicate/shadow any of Python module names.
For example: /Users/lcc/virtualenv/matplotlib/my_first_pandas_prog.py

Theano tensor import error

I have been trying to import theano.tensor in my code.
I have used theano.tensor before. All of my previous code importing theano.tensor works perfectly in my machine. Now I am trying to write another script importing the tensor from theano and I am getting the following exception.
Traceback (most recent call last):
File "code.py", line 2, in <module>
import theano.tensor as T
File "/anaconda3/lib/python3.5/site-packages/theano/__init__.py", line 52, in <module>
from theano.gof import (
File "/anaconda3/lib/python3.5/site-packages/theano/gof/__init__.py", line 56, in <module>
from theano.gof.opt import (
File "/anaconda3/lib/python3.5/site-packages/theano/gof/opt.py", line 11, in <module>
import pdb
File "/anaconda3/lib/python3.5/pdb.py", line 75, in <module>
import code
File "/localtmp/saikat/CovInfo/Closure/code.py", line 2, in <module>
import theano.tensor as T
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/__init__.py", line 6, in <module>
from theano.tensor.basic import *
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/basic.py", line 17, in <module>
from theano.tensor import elemwise
File "/anaconda3/lib/python3.5/site-packages/theano/tensor/elemwise.py", line 13, in <module>
from theano import scalar
File "/anaconda3/lib/python3.5/site-packages/theano/scalar/__init__.py", line 2, in <module>
from .basic import *
File "/anaconda3/lib/python3.5/site-packages/theano/scalar/basic.py", line 25, in <module>
from theano import gof, printing
File "/anaconda3/lib/python3.5/site-packages/theano/printing.py", line 22, in <module>
from theano.compile import Function, debugmode, SharedVariable
File "/anaconda3/lib/python3.5/site-packages/theano/compile/__init__.py", line 9, in <module>
from theano.compile.function_module import *
File "/anaconda3/lib/python3.5/site-packages/theano/compile/function_module.py", line 22, in <module>
import theano.compile.mode
File "/anaconda3/lib/python3.5/site-packages/theano/compile/mode.py", line 77, in <module>
OPT_NONE = gof.Query(include=[], exclude=exclude)
AttributeError: module 'theano.gof' has no attribute 'Query'
I cannot find any plausible reason for this exception.
I guess i got your problem. See in the error log:
File "/anaconda3/lib/python3.5/pdb.py", line 75, in <module>
import code
I believe there is another script called code.py in Theano which gets called from pdb.py when python interpreter executes your script which is also named as code.py. I am guessing python interpreter is mixing up these two scripts and executing the wrong one! You can change the filename and check whether the error disappear or not.

Error while importing SQLObject on Windows

I am getting following error while importing SQLObject on Window. Does anyone knows what is this error about and how to solve it?
==============================
from sqlobject import *
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\__init__.py", line 5, in <module>
from main import *
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\main.py", line 32, in <module>
import dbconnection
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\dbconnection.py", line 17, in <module>
from joins import sorter
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\joins.py", line 5, in <module>
import events
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\events.py", line 3, in <module>
from sqlobject.include.pydispatch import dispatcher
File "c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg\sqlobject\include\pydispatch\dispatcher.py", line 30, in <module>
import saferef, robustapply, errors
EOFError: EOF read where object expected
Looks like your c:\python26\lib\site-packages\sqlobject-0.10.4-py2.6.egg file may be truncated or otherwise damaged. How does it compare to a freshly downloaded one (in terms of both length and checksum)?

Categories

Resources