I have an issue with using Python3.6 and pandas to read csv data. Everything was working fine then I did a system update on my Arch install
sudo pacman -Syu
Then when trying to run any script with pandas imported I got the following error:
from .sqldf import *
File "/usr/lib/python3.6/site-packages/pandasql/sqldf.py", line 3, in <module>
from pandas.io.sql import to_sql, read_sql
File "/usr/lib/python3.6/site-packages/pandas/io/sql.py", line 23, in <module>
from pandas.core.api import DataFrame, Series
ImportError: cannot import name 'DataFrame'
I get this error with any code importing pandas, such as:
import pandas
print ('Hello')
So it it an issue with pandas, but I cannot seem to find the root of the cause online anywhere. Any help with this problem would be greatly appreciated!
Full Error:
from pandas import DataFrame
File "/usr/lib/python3.6/site-packages/pandas/__init__.py", line 42, in <module>
from pandas.core.api import *
File "/usr/lib/python3.6/site-packages/pandas/core/api.py", line 10, in <module>
from pandas.core.groupby import Grouper
File "/usr/lib/python3.6/site-packages/pandas/core/groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "/usr/lib/python3.6/site-packages/pandas/core/frame.py", line 67, in <module>
from pandas.core.generic import NDFrame, _shared_docs
File "/usr/lib/python3.6/site-packages/pandas/core/generic.py", line 49, in <module>
from pandas.io.formats.format import format_percentiles, DataFrameFormatter
File "/usr/lib/python3.6/site-packages/pandas/io/formats/format.py", line 35, in <module>
from pandas.io.common import (_get_handle, UnicodeWriter, _expand_user,
File "/usr/lib/python3.6/site-packages/pandas/io/common.py", line 4, in <module>
import csv
File "/home/knation/ML/dataScience/DataWrangling/csv.py", line 2, in <module>
import pandasql
File "/usr/lib/python3.6/site-packages/pandasql/__init__.py", line 1, in <module>
from .sqldf import *
File "/usr/lib/python3.6/site-packages/pandasql/sqldf.py", line 3, in <module>
from pandas.io.sql import to_sql, read_sql
File "/usr/lib/python3.6/site-packages/pandas/io/sql.py", line 23, in <module>
from pandas.core.api import DataFrame, Series
ImportError: cannot import name 'DataFrame'
This may also be relevant, my most recent pacman log, any idea if any of these changes could have caused the problem?
[2017-08-08 10:38] [PACMAN] Running 'pacman -Syu'
[2017-08-08 10:38] [PACMAN] synchronizing package lists
[2017-08-08 10:38] [PACMAN] starting full system upgrade
[2017-08-08 10:43] [ALPM] transaction started
[2017-08-08 10:43] [ALPM] upgraded attr (2.4.47-2 -> 2.4.47-3)
[2017-08-08 10:43] [ALPM] upgraded acl (2.2.52-3 -> 2.2.52-4)
[2017-08-08 10:43] [ALPM] upgraded avr-binutils (2.28-1 -> 2.29-1)
[2017-08-08 10:43] [ALPM] upgraded bridge-utils (1.6-1 -> 1.6-2)
[2017-08-08 10:43] [ALPM] upgraded pango (1.40.7-1 -> 1.40.8-1)
[2017-08-08 10:43] [ALPM] upgraded libxkbcommon (0.7.1-1 -> 0.7.2-1)
[2017-08-08 10:43] [ALPM] upgraded gtk-update-icon-cache (3.22.17-1 -> 3.22.18-1)
[2017-08-08 10:43] [ALPM] upgraded libsystemd (234.11-3 -> 234.11-4)
[2017-08-08 10:43] [ALPM] upgraded gtk3 (3.22.17-1 -> 3.22.18-1)
[2017-08-08 10:43] [ALPM] upgraded e2fsprogs (1.43.4-1 -> 1.43.5-1)
[2017-08-08 10:43] [ALPM] upgraded systemd (234.11-3 -> 234.11-4)
[2017-08-08 10:43] [ALPM] upgraded sqlite (3.19.3-1 -> 3.20.0-1)
[2017-08-08 10:43] [ALPM] upgraded chromium (60.0.3112.78-1 -> 60.0.3112.90-1)
[2017-08-08 10:43] [ALPM] upgraded ffmpeg (1:3.3.2-2 -> 1:3.3.3-1)
[2017-08-08 10:43] [ALPM] upgraded firefox (54.0.1-1 -> 55.0-1)
[2017-08-08 10:43] [ALPM] upgraded geoip-database (20170704-1 -> 20170801-1)
[2017-08-08 10:43] [ALPM] upgraded perl-error (0.17024-2 -> 0.17025-1)
[2017-08-08 10:43] [ALPM] upgraded git (2.13.3-2 -> 2.14.0-1)
[2017-08-08 10:43] [ALPM] upgraded glew (2.0.0-1 -> 2.1.0-1)
[2017-08-08 10:43] [ALPM] upgraded gnupg (2.1.21-3 -> 2.1.22-1)
[2017-08-08 10:43] [ALPM] upgraded gparted (0.28.1-1 -> 0.28.1-2)
[2017-08-08 10:43] [ALPM] upgraded linux (4.12.3-1 -> 4.12.4-1)
[2017-08-08 10:43] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2017-08-08 10:43] [ALPM] upgraded linux-headers (4.12.3-1 -> 4.12.4-1)
[2017-08-08 10:43] [ALPM] upgraded linux-lts (4.9.40-1 -> 4.9.41-1)
[2017-08-08 10:43] [ALPM-SCRIPTLET] >>> Updating module dependencies. Please wait ...
[2017-08-08 10:43] [ALPM] upgraded linux-lts-headers (4.9.40-1 -> 4.9.41-1)
[2017-08-08 10:43] [ALPM] upgraded python-prompt_toolkit (1.0.14-1 -> 1.0.15-1)
[2017-08-08 10:43] [ALPM] upgraded s-nail (14.9.0-1 -> 14.9.3-1)
[2017-08-08 10:43] [ALPM] upgraded systemd-sysvcompat (234.11-3 -> 234.11-4)
[2017-08-08 10:43] [ALPM] upgraded vim-runtime (8.0.0722-1 -> 8.0.0851-1)
[2017-08-08 10:43] [ALPM] upgraded vim (8.0.0722-1 -> 8.0.0851-1)
Note: If I run in a Python terminal it seems there are no issues, just the script.
So this was a big waste of time, the error seemed to have nothing to do with the script that I was using to test. Once I moved it out of the directory it was in everything worked fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.