如何将GUI代码添加到Pandas脚本中?

我在将我的GUI代码与我的pandas脚本结合时需要一些帮助。我的GUI代码将允许用户浏览Excel文件。我的熊猫代码将合并这些Excel文件并提供输出。

GUI代码:

import pandas as pd
from gooey import Gooey, GooeyParser

@Gooey(program_name="Query Process Automation")
def parse_args():
    parser = GooeyParser()
    parser.add_argument('CYTB',
                        action='store',
                        widget='FileChooser',
                        help="Source Excel file")

    parser.add_argument('PY_Queries',
                        action='store',
                        widget='FileChooser',
                        help="Source Excel file")

    parser.add_argument('Mapping',
                        action='store',
                        widget='FileChooser',
                        help="Source Excel file")

    parser.add_argument('Standard_Queries',
                        action='store',
                        widget='FileChooser',
                        help="Source Excel file")


    args = parser.parse_args()
    return args

if __name__ == '__main__':
    args = parse_args()
    input_file = args.CYTB
    input_file = args.PY_Queries
    input_file = args.Mapping
    input_file = args.Standard_Queries
    print("Done")

合并Excel文件的熊猫代码:

import pandas as pd

Sheet1 = input("Path of the account1 saved : ")
Sheet2 = input("Path of the account2 saved : ")

df1 = pd.read_excel(Sheet1)
df2 = pd.read_excel(Sheet2)

df3 = df1.merge(df2, how = "outer", on = ("Code", "Name"))

Sheet3 = input("Path of the account3 saved : ")

df4 = pd.read_excel(Sheet3)

df5 = df5 = df3.merge(df4, how = "left", on = ("Code", "Name"))

df5.to_excel("New_output.xlsx")
评论