目前,我正在尝试将tkinter python脚本转换为exe文件。我正在使用cx_freeze来做到这一点。当我尝试添加其他文件时,它某种程度上不再起作用。在下面我使用的最小示例中,您可以看到我使用的方法。
import tkinter as tk
import numpy.core._methods, numpy.lib.format
class Main(tk.Tk):
def __init__(self, *args, **kwargs):
tk.Tk.__init__(self, *args, **kwargs)
self.geometry("700x400")
self.wm_iconbitmap('test.ico')
container = tk.Frame(self)
container.pack(side="top", fill="both", expand = True)
container.grid_rowconfigure(0, weight=1)
container.grid_columnconfigure(0, weight=1)
self.frames = {}
for F in (StartPage, PageOne):
frame = F(container, self)
self.frames[F] = frame
frame.grid(row=0, column=0, sticky="nsew")
self.show_frame(StartPage)
def show_frame(self, cont):
frame = self.frames[cont]
frame.tkraise()
frame.update_page() # <-- update data on page when you click button
def get_page(self, page_class):
return self.frames[page_class]
class StartPage(tk.Frame):
def __init__(self, parent, controller): …Run Code Online (Sandbox Code Playgroud) 对于我的 R 程序,我想将数据框中的空值替换为另一个数据框中相同位置的值。例如:
A<- data.frame(matrix(ncol = 5, nrow = 2))
A[1,] <- c(1,NA,2,2,4)
A[2,] <- c(1,NA,NA,2,4)
B<- data.frame(matrix(ncol = 5, nrow = 2))
B[1,] <- c(2,3,4,2,4)
B[2,] <- c(1,4,7,2,9)
Run Code Online (Sandbox Code Playgroud)
新的数据框应该是:
A_updated<- data.frame(matrix(ncol = 5, nrow = 2))
A_updated[1,]<-c(c(1,3,2,2,4)
A_updated[2,]<-c(c(1,4,7,2,4)
Run Code Online (Sandbox Code Playgroud)
这可能吗?如果可以,有人可以帮助我吗?
提前谢谢了
我想seaborn使用以下数据框创建散点图:
df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [2, 4, 6, 8], 'C':['y', 'y', 'n', 'n'], 'D': [1, 1, 2, 2]})
Run Code Online (Sandbox Code Playgroud)
在我的图表中应该A是x-variable和。此外,我想根据列进行颜色。最后,何时标记应为开放面(无面色)以及何时标记应为封闭面。我最初的想法是使用and参数:By-variableDC='y'C='n'huestyle
sns.scatterplot(x='A', y='B', data=df, hue='D', style ='C')
Run Code Online (Sandbox Code Playgroud)
但是,我未能获得我正在寻找的图表。
cx-freeze ×1
dataframe ×1
na ×1
pandas ×1
python ×1
python-3.x ×1
r ×1
scatter-plot ×1
seaborn ×1
tkinter ×1