Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas module not working
#1
Hi All,

I recently got a new computer I installed python v 3.10 and am using the pycharm IDE.

I have installed pandas but it is not working.

I am getting this error message everytime I run the code.

Traceback (most recent call last):
  File "C:\Users\Hass\Desktop\test\K-Means.py", line 7, in <module>
    import pandas as pd
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\__init__.py", line 48, in <module>
    from pandas.core.api import (
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\core\api.py", line 29, in <module>
    from pandas.core.arrays import Categorical
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\core\arrays\__init__.py", line 11, in <module>
    from pandas.core.arrays.interval import IntervalArray
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\core\arrays\interval.py", line 90, in <module>
    from pandas.core.indexes.base import ensure_index
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\core\indexes\base.py", line 143, in <module>
    from pandas.core.arrays.sparse import SparseDtype
  File "C:\Users\Hass\Desktop\test\venv\lib\site-packages\pandas\core\arrays\sparse\__init__.py", line 3, in <module>
    from pandas.core.arrays.sparse.accessor import (
ValueError: source code string cannot contain null bytes
Any help in resolving this issue will be appreciated.
Reply
#2
How did you install pandas? What is the OS?
Reply
#3
Hass Wrote:Desktop\test\venv
Are you aware of that now run from a virtual environment(venv)❓
That's ok but you have to install to environment an test hat it work there.
Look at Configure a Python interpreter.
PyCharm dos a lot of automatic setup like make a virtual environment,but you should(i would say most) learn to also to this from command line.
Here a quick run.
# Test version 
G:\div_code
λ python -V
Python 3.10.4

G:\div_code
λ pip -V
pip 22.0.4 from C:\Python310\lib\site-packages\pip (python 3.10)

# Path to executable used in virtual enviroment the Path will be different
G:\div_code
λ python -c "import sys; print(sys.executable)"
C:\python310\python.exe

# Test that pandas work
G:\div_code
λ python
Python 3.10.4 (tags/v3.10.4:9d38120, Mar 23 2022, 23:13:41) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>>
>>> pandas.__version__
'1.4.1'
>>> exit()
So here i have Pandas install to default Python version,if work like this can choice Setting an existing Python interpreter.
This is normal starting point as most new users install to there default Python version with pip install pandas.
I have seen sevral times with new PyChram users,that the don't that virtual environment is automatic created.
I don't use PyChram,just obversions of Thread we have gotten here.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  can not import anaconda pandas module. PySpark pandas module is imported!! aupres 0 724 Aug-06-2023, 01:09 AM
Last Post: aupres
  working with TLV module Object Jennifer_Jone 3 1,156 Mar-14-2023, 07:54 PM
Last Post: Jennifer_Jone
  Unsure why module is not working garynewport 0 773 Feb-15-2023, 03:21 PM
Last Post: garynewport
  Cannot make 'pandas' module to work... ellie145 2 4,204 Jan-05-2021, 09:38 PM
Last Post: ellie145
  importing module - not working jdhamblett 3 3,031 Jun-22-2020, 07:33 PM
Last Post: jdhamblett
  setup() from turtle module not working bobfat 7 6,169 Oct-28-2019, 11:05 AM
Last Post: newbieAuggie2019
  pyinstaller not working with acoustics module pynz 2 2,778 Oct-08-2019, 07:56 AM
Last Post: pynz
  import keyboard module doesn't get found - working on laptop but no on raspberry pi.. HANSJORG2 1 8,177 Mar-16-2018, 02:48 PM
Last Post: sparkz_alot
  Logging module stopped working! llanitedave 1 7,997 Oct-18-2017, 06:45 AM
Last Post: llanitedave

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020