Can I run numpy and pandas with Jython

2019-01-18 22:49发布

We have some Java code we want to use with new code we plan to write in Python, hence our interest in using Jython. However we also want to use numpy and pandas libraries to do complex statistical analysis in this Python code.

Is it possible to call numpy and pandas from Jython?

4条回答
何必那么认真
2楼-- · 2019-01-18 23:22

Keep an eye in JyNI which is at alpha.2 version, as of March-2014.

查看更多
冷血范
3楼-- · 2019-01-18 23:23

Not directly.

One option which I've used in the past is to use jsonrpclib (which works for both) to communicate between python and jython. There's even a server builtin which makes things quite simple. You'll just need to figure out whether the gains of using numpy are worth the additional overhead.

查看更多
Summer. ? 凉城
4楼-- · 2019-01-18 23:26

Especially if you don't want to use raw Numpy, but other Python frameworks that depend on it, JyNI will be the way to go once it is mature. However, it is not yet capable to import Numpy.

Until then you can use Numpy from Java by embedding CPython. See the Numpy4J-project for this (I didn't test it myself though).

查看更多
成全新的幸福
5楼-- · 2019-01-18 23:33

You can't use numpy from Jython at this time. But if you're willing to use CPython instead of Jython, there are some open source Java projects that work with numpy (and presumably pandas).

查看更多
登录 后发表回答