I have a Java program which gets data from a database in the form of a list of objects and an object just has some primitive types associated to it like strings and ints.
Now I need to pass the data from Java to a Python program to do some calculations and then return the calculated output to the Java program.
My Python program has the following imports
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
import numpy as np
import scipy.misc as sp
from scipy.optimize import minimize
from scipy.stats import poisson
Does anyone have any ideas for how I could achieve this? I looked at Jython but saw that it isn't compatible with NumPy and others but there is a compatibility layer available called JyNI however I can't find many examples to getting a working solution.
EDIT: From my research, there doesn't seem to be a suitable library which will handle communication between Java and Python but would it be possible to the Java program to start a Python script which looks for say a JSON file containing the data it needs for processing and then prints an output that Java can pick up?