我允许用户在执行合并操作之前选择excel文件。当代码在jupyter笔记本中为第一个实例运行时。运行正常。在第二个实例中,当我再次运行整个代码时,代码的执行需要更长的时间。强迫我取消该会话,然后再次重新打开一个jupyter笔记本会话。
我与tkinter一起使用Pandas打开和读取文件。下面是我的代码段。
import pandas as pd
import numpy as np
import tkinter as tk
from tkinter import filedialog
# Selecting the files
root = tk.Tk()
root.withdraw()
root.update()
# Garn Team Data or Data from ADP R
emp_data=pd.read_excel(filedialog.askopenfilename()
,header = 0)
# Pay Team Data
team_data=pd.read_excel(filedialog.askopenfilename()
, header = 0)
#Merging the files
data_applied=pd.merge(left=emp_data,right=team_data,on = 'Empl ID')
print(data_applied)
如何在不关闭会话的情况下第二次改善代码的执行?
关于, 仁。