How can I import Pandas with Jython

后端 未结 2 859
一个人的身影
一个人的身影 2021-01-18 08:14

I\'m new to python, and I\'ve install Jython2.7.0

Java

import org.python.util.PythonInterpreter;
import org.python.core.*; 

public          


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-18 08:46

    You currently cannot use Pandas with Jython, because it depends on CPython specific native extensions. One dependency is NumPy, the other is Cython (which is actually not a native CPython extension, but generates such).

    Keep an eye on the JyNI project ("Jython Native Interface"). It enables Jython to use native CPython-extensions and its exact purpose is to solve issues like that encountered by you. However, it is still under heavy development and not yet capable of loading Pandas or NumPy into Jython, but both frameworks are high on the priority list.

    (E.g. ctypes is already working to some extend.)

    Also, it is currently POSIX only (tested on Linux and OSX).

    If you wouldn't require Jython specifically, but just some Java/Pandas interoperation, an already workable solution would be to embed the CPython interpreter. JPY and JEP are projects that provide this. With either of them you should be able to interoperate Java and Pandas (or any other CPython-specific framework).

提交回复
热议问题