I am attempting to call a python script from a master script. I need the dataframe to be generated only one from within the master script and then passed on to the subprocess script as an argument to be used inside the subprocess.
Following is my attempt at writing the required python master script.
from subprocess import PIPE, Popen
import pandas as pd
test_dataframe = pd.read_excel(r'C:\test_location\file.xlsx',sheetname='Table')
sp = Popen(["python.exe",'C:/capture/test.py'], shell=True, stdin=PIPE, stdout=PIPE, stderr=PIPE)
sp.communicate(test_dataframe)
And here is the error:
TypeError: argument 1 must be convertible to a buffer, not DataFrame
This is my first time trying to use the subprocess module so i am not very good at it yet. Any help will be much appreciated.