خرید بک لینک

Vote count: 0

I am using python to query an impala database and retu the results of the SQL query as a dataframe. I would like to pass that dataframe as stdin to a subprocess call to another program, and caot figure out how.

# create dataframe from query results
query_df = cur.execute(sql_query)

# create subprocess command
subprocess_cmd = r'''{} | java -Xmx16g -jar snpeff.jar -t GRCh37.75 > out_file}'''.format(query_df)

# run the subprocess command
ps = sp.Popen(subprocess_cmd, shell=True, stdout=sp.PIPE, stderr=sp.PIPE, cwd=os.getcwd())
try:
    print ps.communicate()
except sp.CalledProcessError as e:
    print e

I can print the pandas dataframe to stdout, as follows:

query_df.to_csv(sys.stdout, sep='t')

But I have no idea how to feed it into subprocess, or if I'm on the right track. Thanks in advance for any help!

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 22 ارديبهشت 1395 ساعت: 7:08

صفحه بندی