Closed goyodiaz closed 9 years ago
You must be picking up another version of pandas somehow. The error you are seeing IIRC is from a somewhat older version of pandas
This works just fine on linux with 3.4 (mac is below). I know this is also tested.
Python 3.4.3 |Continuum Analytics, Inc.| (default, Mar 6 2015, 12:07:41)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: pd.__version__
Out[1]: '0.17.0'
In [2]: src = 'first, second\n0,0.1\n1,1.1'
In [3]: from io import StringIO
In [4]: pd.read_csv(StringIO(src), na_values='-999.99')
Out[4]:
first second
0 0 0.1
1 1 1.1
show pd.__version__
.
it looks like you are directly running print_versions
which is another indication you are actually using an older version (BUT ``print_versions actually will look at your environment and NOT from where it is called)
I see exactly the same error:
python b.py
0.17.0
Traceback (most recent call last):
File "b.py", line 8, in
cat b.py from StringIO import StringIO import pandas as pd src = """first, second 0,0.1 1,1.1 """ print pd.version df = pd.read_csv(StringIO(src), na_values='-999.99')
lsb_release --all No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.3 LTS Release: 14.04
python Python 2.7.10 |Anaconda 2.1.0 (64-bit)| (default, May 28 2015, 17:02:03) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. Anaconda is brought to you by Continuum Analytics. Please check out: http://continuum.io/thanks and https://binstar.org
pd.__version__
is also 0.17.0 here.
More facts:
engine='python
makes the test pass.In order to clean my python environment as much as possible I uninstalled every non-distro package/version and every distro package not installed by default except dependencies of other software I use: python2.7 numpy, python2.7 gdal bindings, gnome stuff... I even uninstalled pip (packaged python3 pip is almost useless in willy anyway).
I also did my best to ensure there where nothing python-related in ~/.local/bin, ~/.local/lib, /usr/local/bin and /usr/local/lib. I also made sure there were nothing called pandas in every mounted file system. I then used get-pip.py to install pip2 and pip3 and installed python2 and python3 pandas. The issue is still present.
While this is not critical to me (it just broke one test for a function I never use in that way) I would really like to understand what's going on, but I do not know where to look at.
so the error line:
File "pandas/parser.pyx", line 1818, in pandas.parser.kset_float64_from_list (pandas/parser.c:22852)
TypeError: 'set' object does not support indexing
tells me that you are using some kind of development version of pandas (somewhere). This function DOES not exist in master or 0.17.0.
pls make sure that you are not in a development directory when trying to import pandas.
Its not clear what you actually have installed, so pls create a new virtual env or use conda
.
I installed pandas via pip Either our environment is contaminated somehow, or what pip brings is now what you/we expect?
Will check and get back to you.
My "pip install pandas==0.17.0" downloads https://pypi.python.org/packages/source/p/pandas/pandas-0.17.0.tar.gz#md5=55d34c4d5655c94ca30a59dea6b36316
which contains file pandas/parser.c, which contains the following in line 1554:
static kh_float64_t ___pyx_f_6pandas_6parser_kset_float64_from_list(PyObject ); /_proto/
ok, it appears that when I distributed this it didn't rebuild the .c files (and had a newer version I was testing out). very odd.
so will fix for 0.17.1 (e.g. will make a clean version). you can simply regenerate the .c files (you need cython installed).
e.g.
make clean
python setup.py install
Thanks, Jeff. That worked.
Other than this bug, would you consider pip-obtained pandas 0.17.0 as safe to use?
yep as I said the .c for he parser came from a or which is now merged
Test case: