-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Python 3 compatibility #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Initial rough & ready pass so that pandas can be installed on Python 3, using distribute. Importing pandas still fails.
Most of the changes were to do with division methods, as operator.div no longer exists.
…ed to .items() by 2to3.
This is really great-- thanks for doing this. It's also impetus for me to get Python3+NumPy+SciPy installed on my machine for testing purposes. I will do that, run the test suiteu, and merge this in as soon as I can. |
You're welcome! |
* py3-compat-merge: All but one test now passing on Python 3. Sort out division for in sparse code. Use .iterkv() instead of .iteritems(), which gets incorrectly converted to .items() by 2to3. Hack so test works on Python 3. More changes to support Python 3 better. Fix up more tests for Python 3. Fixes so more tests pass on Python 3. Pandas can now be imported successfully in Python 3. Pandas installs on Python 3
Rebased this and merged it in. There are some test failures in what appear to be corner cases in NumPy trunk, I will have to investigate those some other time |
Thanks Wes. For the record, I was testing with Numpy 1.6.1. |
Thomas, can you help me figure out why the cython command stopped working once setuptools is introduced (for the purpose of running 2to3)? I'm talking about:
|
in the meantime, I kludged things so setuptools only gets imported in py3k, so no urgency |
I'll have a look - I'd just been doing |
It appears to work for me with setuptools 0.6 from Ubuntu repos, or with distribute 0.6.19 as installed by virtualenv. abc running cython cythoning pandas/src/tseries.pyx to pandas/src/tseries.c cythoning pandas/src/sparse.pyx to pandas/src/sparse.c (the |
that's prior to my kludge, right? i was running it on win32 to see if I can distribute 3.x binaries for the imminent next release. sigh, windows, the source of so much dev unhappiness |
Here's another not so awesome thing: on 3.1/3.2 on Win32 (haven't tested Win64 yet), the default csv writer writes not 1, but 2 line breaks per line. Specifying explicitly lineterminator='\n' for now which solves the problem (I think csv.reader interprets CRLF as \n\n which seems really bad) |
I tweaked your kludge so it imported setuptools on both platforms (the With Windows, I think it writes I don't have Windows to hand, but I can test in Wine if you like. |
No doubt there are ways this could be improved, but this gets it installing, importing, and almost passing the test suite.
There's one test failure left, and I think that's something odd with numpy, specifically the
ndarray.searchsorted()
method. It returns seemingly random results when it's called inpanel.get_axis_dummies()
- but I can't replicate those results calling searchsorted on identical arrays interactively.It doesn't add any failures to the Python 2 test suite (one test is failing for me in master), but I've only checked this with Python 2.7.