123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204 |
- import os
- import webbrowser
- import tkinter
- from newtkinter import askopenfilename, asksaveasfilename
- import tkinter.messagebox
- from tkinter.scrolledtext import ScrolledText
- import chardet
- import datascience.controller
- from system import exception_catch, QueueController
- queue_controller = QueueController()
- render_dict = {} # 保存了画图的List
- learn_dict = {} # 保存数据处理
- PATH = os.getcwd()
- sheet_list = []
- machine_controller = datascience.controller.MachineLearner()
- SCREEN = tkinter.Tk()
- bg_color = "#FFFAFA" # 主颜色
- buttom_bg_color = "#FFFAFA" # 按钮颜色
- word_color = "#000000" # 文字颜色
- SCREEN["bg"] = bg_color
- FONT = ("黑体", 11) # 设置字体
- FONT1 = ("黑体", 13)
- SCREEN.title("CoTan数据处理")
- SCREEN.resizable(width=False, height=False)
- SCREEN.geometry("+10+10") # 设置所在位置
- gui_width = 13 # 标准宽度
- gui_height = 2
- row = 0
- column = 0
- stored_list = []
- clean_list = []
- # 层叠多图
- base_image = None
- top_image = None
- # 数据清洗
- clean_default_script = """#输入你的数据清洗执行代码
- Done_Row=[] #输入操作的行号
- Done_Column=[] #输入操作的列号
- axis=True #True-操作行,False-操作列
- name='' #方法代号
- def check(data, row, column, get, R, C): #检查方法
- return True
- def done(data, row, column, get, R, C): #应用修正方法
- return DEL
- """
- clean_help = """
- 使用Python代码进行数据清洗
- 1)代码结构
- Done_Row=[] 代码用来检测的数据的列号
- Done_Column=[] 代码用来检测的数据的行号
- 不在以上指定范围内的数据将不会被检测,若为空则整个表格检测
- axis 执行删除方法时删除行或者列
- name 方法代号
- check 检查方法
- 输入:当前的值(输入的是一个值而不是一行(列)或整个列表)
- 输入:row和column当前值来自的行号(row)和列号(column)
- 输入:get当前检查的所有数据:类型是表格
- 输入:R和C当前值所来自的行和列的所有数据:类型是一维表格
- 输出:输出布尔为True代表该值可以使用,输出布尔为假表示该值不可使用
- done 不可使用的数值改造方法
- 输入:内容同上
- 输出:改造值或者DEL
- DEL:代表删除改值所在的行(axis=True)或列(axis=False)
- 2)扩展
- 默认:pd-pandas,re-re[正则表达式],Sheet-包含所有表格,用Sheet['name']访问名字为name的表格(注意引号别漏了)
- 支持:可以使用import导入语句,支持python语法
- """
- drawing_parameters = """
- 输入python变量赋值代码:渲染设置
- title #设置标题:str
- vice_title #设置副标题:str
- show_Legend #是否显示图例:bool
- show_Visual_mapping #是否使用视觉映射:bool
- is_color_Visual_mapping #是否为颜色视觉映射:bool[否则为大小视觉映射]
- min_Visual_mapping #映射的最小值
- max_Visual_mapping #映射的最大值
- ......(我太懒了, 设置太多不想写了)
- """
- class UIAPI:
- @staticmethod
- @exception_catch()
- def add_from_python_gui():
- file_dir = askopenfilename(
- title="选择载入的py", filetypes=[("Python", ".py"), ("Txt", ".txt")]
- )
- name = sheet_name.get().replace(" ", "")
- if name == "":
- name = os.path.splitext(os.path.split(file_dir)[1])[0]
- with open(file_dir, "r") as f:
- code = f.read()
- return code, name
- @staticmethod
- @exception_catch()
- def get_sheet_name_gui(): # 获得名字统一接口
- global sheet_list
- try:
- return sheet_list[sheet_box.curselection()[0]]
- except IndexError:
- try:
- return sheet_list[0]
- except IndexError:
- return None
- @staticmethod
- @exception_catch()
- def update_sheet_box_gui():
- global SCREEN, sheet_box, sheet_list
- sheet_list = machine_controller.get_sheet_list()
- sheet_box.delete(0, tkinter.END)
- sheet_box.insert(tkinter.END, *sheet_list)
- @staticmethod
- @exception_catch()
- def update_combo_box_gui():
- overlap_box.delete(0, tkinter.END)
- if base_image is not None:
- overlap_box.insert(tkinter.END, f"底图: {base_image}")
- if top_image is not None:
- overlap_box.insert(tkinter.END, f"顶图: {top_image}")
- @staticmethod
- @exception_catch()
- def add_csv_gui():
- file_dir = askopenfilename(title="选择载入的CSV", filetypes=[("CSV", ".csv")])
- csv_sep = sep.get()
- csv_encoding = encoding.get()
- str_ = bool(str_must.get())
- index = bool(index_must.get())
- name = sheet_name.get().replace(" ", "")
- if name == "":
- name = os.path.splitext(os.path.split(file_dir)[1])[0]
- if csv_encoding == "":
- with open(file_dir, "rb") as f:
- csv_encoding = chardet.detect(f.read())["encoding"]
- if csv_sep == "":
- csv_sep = ","
- return csv_encoding, csv_sep, file_dir, index, name, str_
- @staticmethod
- @exception_catch()
- def to_csv_gui():
- save_dir = asksaveasfilename(title="选择保存的CSV", filetypes=[("CSV", ".csv")])
- csv_sep = sep.get()
- return csv_sep, save_dir
- @staticmethod
- @exception_catch()
- def update_index_box_gui(index):
- global SCREEN, index_box
- index_box.delete(0, tkinter.END)
- index_box.insert(tkinter.END, *index)
- @staticmethod
- @exception_catch()
- def vitables_gui(data, name):
- global bg_color, FONT1
- new_top = tkinter.Toplevel(bg=bg_color)
- new_top.title(name)
- new_top.geometry("+10+10") # 设置所在位置
- text = ScrolledText(new_top, font=FONT1, height=50)
- text.pack(fill=tkinter.BOTH)
- text.insert("0.0", data)
- text.config(state=tkinter.DISABLED)
- new_top.resizable(width=False, height=False)
- @staticmethod
- @exception_catch()
- def get_des_bool_gui():
- return bool(des_bool.get())
- @staticmethod
- @exception_catch()
- def sort_by_column_gui():
- ascending = not bool(ascending_type.get())
- new = bool(ascending_new.get())
- return new, ascending
- @staticmethod
- @exception_catch()
- def add_baseline_gui(ascending_type_, sort_by_):
- ascending = not bool(ascending_type_.get())
- value = int(sort_by_.get())
- return ascending, value
- @staticmethod
- @exception_catch()
- def update_sort_box_gui():
- global stored_list, stored_box
- re = []
- d = {True: "正序", False: "倒叙"}
- for i in stored_list:
- re.append(f"列号:{i[0]}, 排序方式{d[i[1]]}")
- stored_box.delete(0, tkinter.END)
- stored_box.insert(tkinter.END, *re)
- @staticmethod
- @exception_catch()
- def get_stored_box_index_gui():
- return stored_box.curselection()[0]
- @staticmethod
- @exception_catch()
- def get_ascending_new_gui():
- new = bool(ascending_new.get())
- return new
- @staticmethod
- @exception_catch()
- def slice_data_gui():
- def split_slice_core(slice_list, func_type):
- a = []
- for i in slice_list:
- b = i.get().replace(" ", "")
- if b == "":
- a.append(None)
- else:
- try:
- a.append(func_type(b))
- except ValueError:
- a.append(None)
- if a[0] is not None and a[1] is None:
- a[1] = a[0] + 1
- a[2] = None
- return a
- the_column_type = column_type.get()
- is_iloc = True
- if the_column_type == 0: # 输入的列号
- column_ = slice(*split_slice_core(column_clist, int))
- elif the_column_type == 1:
- is_iloc = False
- column_ = slice(*split_slice_core(column_clist, str))
- else:
- get = column_clist[0].get().replace(" ", "").split(",")
- column_ = []
- for i in get:
- try:
- column_.append(int(i))
- except ValueError:
- pass
- the_row_type = row_type.get()
- if the_row_type == 0: # 输入的列号
- row_ = slice(*split_slice_core(row_clist, int))
- elif the_row_type == 1:
- row_ = slice(*split_slice_core(row_clist, str))
- else:
- get = row_clist[0].get().replace(" ", "").split(",")
- row_ = []
- for i in get:
- try:
- row_.append(int(i))
- except ValueError:
- pass
- new = bool(slice_new.get())
- return column_, is_iloc, new, row_
- @staticmethod
- @exception_catch()
- def del_data_gui():
- column_ = column_clist[0].get().replace(" ", "").split(",")
- row_ = row_clist[0].get().replace(" ", "").split(",")
- new = bool(slice_new.get())
- return column_, new, row_
- @staticmethod
- @exception_catch()
- def get_clean_code_gui():
- exp = clean_code.get("0.0", tkinter.END)
- return exp
- @staticmethod
- @exception_catch()
- def view_cleaning_script_gui():
- name = clean_list[API.get_clean_func_box_index_gui()]
- API.update_clean_code(machine_controller.get_clean_code(name))
- @staticmethod
- @exception_catch()
- def get_clean_func_box_index_gui():
- return clean_func_box.curselection()[0]
- @staticmethod
- @exception_catch()
- def show_dictionary_gui():
- tkinter.messagebox.showinfo("帮助字典", clean_help)
- @staticmethod
- @exception_catch()
- def open_python_for_clean_gui():
- global clean_code
- file_dir = askopenfilename(
- title="打开Python脚本", filetypes=[("Python", ".py"), ("TXT", ".txt")]
- )
- with open(file_dir) as f:
- get = f.read()
- clean_code.delete("0.0", tkinter.END)
- clean_code.insert("0.0", get)
- @staticmethod
- @exception_catch()
- def reset_clean_code_gui():
- global clean_code, clean_default_script
- API.update_clean_code(clean_default_script)
- @staticmethod
- @exception_catch()
- def update_render_box_gui():
- global render_dict, render_box, machine_controller
- render_dict = machine_controller.get_all_render()
- render_box.delete(0, tkinter.END)
- render_box.insert(tkinter.END, *render_dict.keys())
- @staticmethod
- @exception_catch()
- def get_draw_as_well_gui():
- return bool(draw_as_well.get())
- @staticmethod
- @exception_catch()
- def render_box_index_gui():
- return render_box.curselection()[0]
- @staticmethod
- @exception_catch()
- def rendering_one_gui():
- render_dir = asksaveasfilename(title="选择渲染保存地址", filetypes=[("HTML", ".html")])
- try:
- assert render_dir.startswith(".html")
- except AssertionError:
- render_dir += ".html"
- return render_dir
- @staticmethod
- @exception_catch()
- def rendering_gui():
- render_dir = asksaveasfilename(title="选择渲染保存地址", filetypes=[("HTML", ".html")])
- try:
- assert render_dir.startswith(".html")
- except AssertionError:
- render_dir += ".html"
- return render_dir
- @staticmethod
- @exception_catch()
- def set_dtype_gui():
- type_ = bool(dtype_func.get())
- name = API.get_sheet_name_gui()
- column_list = dtype_column.get().split(",")
- if column_list == [""]:
- column_list = []
- dtype = dtype_input.get()
- wrong = dtype_wrong.get()
- return column_list, dtype, name, type_, wrong
- @staticmethod
- @exception_catch()
- def datetime_index_gui():
- is_column = bool(replace_index.get()) # 操作行名-False,操作列名-True
- save = bool(replace_type[0].get())
- k = ["start", "end", "freq"]
- init = {}
- for i in range(len(date_input)):
- data = date_input[i].get()
- if data == "":
- continue
- init[k[i]] = data
- if len(init) == 3:
- if bool(date_type.get()): # 使用间隔
- del init["end"]
- else:
- del init["freq"]
- return init, is_column, save
- @staticmethod
- @exception_catch()
- def num_with_name_gui():
- is_column = bool(replace_index.get()) # 操作行名-False,操作列名-True
- save = bool(replace_type[0].get())
- return is_column, save
- @staticmethod
- @exception_catch()
- def num_to_name_gui():
- is_column = bool(replace_index.get()) # 操作行名-False,操作列名-True
- save = bool(replace_type[0].get())
- return is_column, save
- @staticmethod
- @exception_catch()
- def change_index_gui():
- is_column = bool(replace_index.get()) # 操作行名-False,操作列名-True
- iloc = int(replace_iloc.get()) # 替换的列号(行号)
- save = bool(replace_type[0].get())
- drop = not bool(replace_type[1].get())
- return drop, iloc, is_column, save
- @staticmethod
- @exception_catch()
- def replace_index_func_gui():
- the_replace_dict = eval(replace_dict.get())
- is_column = bool(replace_index.get()) # 操作行-False,操作列-True
- save = bool(replace_type[0].get())
- return is_column, save, the_replace_dict
- @staticmethod
- @exception_catch()
- def update_leaner_box_gui():
- global learn_dict, learner_box
- learn_dict = machine_controller.return_learner()
- learner_box.delete(0, tkinter.END)
- learner_box.insert(tkinter.END, *learn_dict.keys())
- @staticmethod
- @exception_catch()
- def get_data_split_gui():
- try:
- split = float(data_split.get())
- assert not split < 0 or 1 < split
- except (AssertionError, ValueError):
- split = 0.3
- return split
- @staticmethod
- @exception_catch()
- def set_learner_gui():
- global chose_learner
- chose_learner.set(API.get_learner_name_gui(True))
- @staticmethod
- @exception_catch()
- def get_learner_name_gui(learner_type=False):
- global learn_dict, learner_box, chose_learner
- if learner_type:
- try:
- return list(learn_dict.keys())[learner_box.curselection()[0]]
- except IndexError:
- try:
- return list(learn_dict.keys)[0]
- except IndexError:
- return None
- else:
- return chose_learner.get()
- @staticmethod
- @exception_catch()
- def askokcancel_gui(messgae):
- return tkinter.messagebox.askokcancel("提示", messgae)
- @staticmethod
- @exception_catch()
- def show_tips_gui():
- tkinter.messagebox.showinfo("使用提示", drawing_parameters)
- @staticmethod
- @exception_catch()
- def show_sorry_gui():
- tkinter.messagebox.showinfo("非常抱歉", "高级别的机器学习请到机器学习板块深入研究...")
- class API(UIAPI):
- @staticmethod
- @exception_catch()
- def clear_rendering():
- machine_controller.clean_render()
- API.update_render_box_gui()
- @staticmethod
- @exception_catch()
- def del_form():
- name = API.get_sheet_name_gui()
- machine_controller.del_sheet(name)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def del_learner():
- learner = API.get_learner_name_gui(True)
- set_learne = API.get_learner_name_gui(False) # 获取学习器Learner
- if set_learne != learner:
- machine_controller.del_leaner(learner)
- API.update_leaner_box_gui()
- @staticmethod
- @exception_catch()
- def visual_learner():
- learner = API.get_learner_name_gui(True)
- data = machine_controller.visual_learner(
- learner, API.askokcancel_gui(f"是否将数据生成表格。\n(可绘制成散点图对比数据)")
- )
- API.vitables_gui(
- f"对象:{learner}\n\n{data[0]}\n\n\n{data[1]}", f"CoTan数据处理 查看数据:{learner}"
- )
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def get_learner_config():
- return learner_parameters.get("0.0", tkinter.END)
- @staticmethod
- @exception_catch()
- def test_learner():
- name = API.get_sheet_name_gui() # 表格数据
- learner = API.get_learner_name_gui()
- try:
- split = float(data_split.get())
- assert not split < 0 or 1 < split
- except (AssertionError, ValueError):
- split = 0.3
- socore = machine_controller.training_machine(
- name, learner, Score_Only=True, split=split
- )[1]
- tkinter.messagebox.showinfo("测试完成", f"针对测试数据评分结果为:{socore}")
- @staticmethod
- @exception_catch()
- def predict_learner():
- name = API.get_sheet_name_gui() # 表格数据
- learner = API.get_learner_name_gui()
- data = machine_controller.predict(name, learner)
- title = f"CoTan数据处理 表格:{name} 学习器:{learner}"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def fit_learner():
- name = API.get_sheet_name_gui() # 表格数据
- learner = API.get_learner_name_gui()
- split = API.get_data_split_gui()
- socore = machine_controller.training_machine(
- name, learner, parameters=API.get_learner_config(), split=split
- )
- tkinter.messagebox.showinfo(
- "训练完成",
- f"针对训练数据({(1 - split) * 100}%)评分结果为:{socore[0]}\n"
- f"针对测试数据评分({split * 100}%)结果为:{socore[1]}",
- )
- @staticmethod
- @exception_catch()
- def add_knn_class():
- API.add_learner_core("Knn_class")
- @staticmethod
- @exception_catch()
- def add_logistic_regression():
- API.add_learner_core("LogisticRegression")
- @staticmethod
- @exception_catch()
- def add_lasso():
- API.add_learner_core("Lasso")
- @staticmethod
- @exception_catch()
- def add_knn_regression():
- API.add_learner_core("Knn")
- @staticmethod
- @exception_catch()
- def add_ridge():
- API.add_learner_core("Ridge")
- @staticmethod
- @exception_catch()
- def add_generalized_linear():
- API.add_learner_core("Line")
- @staticmethod
- @exception_catch()
- def add_learner_core(learner_type): # 添加Lenear的核心
- machine_controller.add_learner(learner_type, parameters=API.get_learner_config())
- API.update_leaner_box_gui()
- @staticmethod
- @exception_catch()
- def feature_extraction():
- name = API.get_sheet_name_gui()
- machine_controller.decision_tree_classifier(name)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def replace_index_func():
- name = API.get_sheet_name_gui()
- is_column, save, the_replace_dict = API.replace_index_func_gui()
- machine_controller.replace_index(name, is_column, the_replace_dict, save)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def change_index():
- name = API.get_sheet_name_gui() # 名字
- drop, iloc, is_column, save = API.change_index_gui()
- machine_controller.change_index(name, is_column, iloc, save, drop)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def num_to_name():
- name = API.get_sheet_name_gui() # 名字
- is_column, save = API.num_to_name_gui()
- machine_controller.number_naming(name, is_column, save)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def num_with_name():
- name = API.get_sheet_name_gui() # 名字
- is_column, save = API.num_with_name_gui()
- machine_controller.name_with_number(name, is_column, save)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def datetime_index(is_date=True):
- name = API.get_sheet_name_gui() # 名字
- init, is_column, save = API.datetime_index_gui()
- if is_date:
- machine_controller.date_index(name, is_column, save, **init)
- else:
- machine_controller.time_naming(name, is_column, save, **init)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def date_index():
- API.datetime_index(True)
- @staticmethod
- @exception_catch()
- def time_index():
- API.datetime_index(False)
- @staticmethod
- @exception_catch()
- def set_dtype():
- column_list, dtype, name, type_, wrong = API.set_dtype_gui()
- if type_: # 软转换
- if wrong != "ignore":
- wrong = "coerce"
- machine_controller.set_dtype(name, column_list, dtype, wrong)
- else:
- machine_controller.as_dtype(name, column_list, dtype, "ignore")
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def python_render(): # 导入绘制方法
- file_dir = askopenfilename(
- title="打开Python脚本", filetypes=[("Python", ".py"), ("TXT", ".txt")]
- )
- with open(file_dir) as f:
- code = f.read()
- API.new_render(machine_controller.custom_graph(code), "自定义图")
- @staticmethod
- @exception_catch()
- def get_rendering_parameters(): # 获取画图的args
- return rendering_parameters.get("0.0", tkinter.END)
- @staticmethod
- @exception_catch()
- def rendering():
- render_dir = API.rendering_gui()
- webbrowser.open(
- machine_controller.render_all(API.get_rendering_parameters(), render_dir)
- )
- API.update_render_box_gui()
- @staticmethod
- @exception_catch()
- def rendering_one():
- render_dir = API.rendering_one_gui()
- list(render_dict.values())[API.render_box_index_gui()].render(render_dir)
- webbrowser.open(render_dir)
- API.update_render_box_gui()
- @staticmethod
- @exception_catch()
- def make_overlap():
- global top_image, base_image
- if base_image is not None and top_image is not None:
- try:
- API.new_render(machine_controller.overlap(base_image, top_image), f"合成图")
- except BaseException:
- raise
- base_image = None
- top_image = None
- API.update_combo_box_gui()
- @staticmethod
- @exception_catch()
- def add_basemap():
- global base_image
- base_image = list(render_dict.keys())[API.render_box_index_gui()]
- API.update_combo_box_gui()
- @staticmethod
- @exception_catch()
- def add_top_image():
- global top_image
- top_image = list(render_dict.keys())[API.render_box_index_gui()]
- API.update_combo_box_gui()
- @staticmethod
- @exception_catch()
- def del_rendering():
- key = list(render_dict.keys())[API.render_box_index_gui()]
- machine_controller.del_render(key)
- API.update_render_box_gui()
- @staticmethod
- @exception_catch()
- def new_render(c, name):
- if API.get_draw_as_well_gui():
- c.render(fr"{PATH}{os.sep}{name}.html")
- API.update_render_box_gui()
- @staticmethod
- @exception_catch()
- def to_geo():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_geo(name, API.get_rendering_parameters()), "Geo地图")
- @staticmethod
- @exception_catch()
- def to_map():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_map(name, API.get_rendering_parameters()), "Map地图")
- @staticmethod
- @exception_catch()
- def to_scattergeo():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_scattergeo(name, API.get_rendering_parameters()), "Geo点地图"
- )
- @staticmethod
- @exception_catch()
- def to_treemap():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_tree_map(name, API.get_rendering_parameters()), "矩形树图")
- @staticmethod
- @exception_catch()
- def to_tree():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_tree(name, API.get_rendering_parameters()), "树状图")
- @staticmethod
- @exception_catch()
- def to_sankey():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_sankey(name, API.get_rendering_parameters()), "桑基图")
- @staticmethod
- @exception_catch()
- def to_sunburst():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_sunburst(name, API.get_rendering_parameters()), "旭日图")
- @staticmethod
- @exception_catch()
- def to_theme_river():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_theme_river(name, API.get_rendering_parameters()), "河流图"
- )
- @staticmethod
- @exception_catch()
- def to_calendar():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_calendar(name, API.get_rendering_parameters()), "日历图")
- @staticmethod
- @exception_catch()
- def to_gauge():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_gauge(name, API.get_rendering_parameters()), "仪表图")
- @staticmethod
- @exception_catch()
- def to_liquid():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_liquid(name, API.get_rendering_parameters()), "水球图")
- @staticmethod
- @exception_catch()
- def to_line3d():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_line3d(name, API.get_rendering_parameters()), "3D折线图")
- @staticmethod
- @exception_catch()
- def to_scatter3d():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_scatter3d(name, API.get_rendering_parameters()), "3D散点图"
- )
- @staticmethod
- @exception_catch()
- def to_bar3d():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_bar3d(name, API.get_rendering_parameters()), "3D柱状图")
- @staticmethod
- @exception_catch()
- def to_word_cloud():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_word_cloud(name, API.get_rendering_parameters()), "词云图"
- )
- @staticmethod
- @exception_catch()
- def to_radar():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_radar(name, API.get_rendering_parameters()), "雷达图")
- @staticmethod
- @exception_catch()
- def to_polar():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_polar(name, API.get_rendering_parameters()), "极坐标图")
- @staticmethod
- @exception_catch()
- def to_pie():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_pie(name, API.get_rendering_parameters()), "饼图")
- @staticmethod
- @exception_catch()
- def to_parallel():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_parallel(name, API.get_rendering_parameters()), "多轴图")
- @staticmethod
- @exception_catch()
- def to_graph():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_graph(name, API.get_rendering_parameters()), "关系图")
- @staticmethod
- @exception_catch()
- def to_format_graph():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_format_graph(name, API.get_rendering_parameters()), "关系图"
- )
- @staticmethod
- @exception_catch()
- def to_funnel():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_funnel(name, API.get_rendering_parameters()), "漏斗图")
- @staticmethod
- @exception_catch()
- def to_heat_map():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_heatmap(name, API.get_rendering_parameters()), "热力图")
- @staticmethod
- @exception_catch()
- def to_boxpolt():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_boxpolt(name, API.get_rendering_parameters()), "箱形图")
- @staticmethod
- @exception_catch()
- def to_pictorialbar():
- name = API.get_sheet_name_gui()
- API.new_render(
- machine_controller.to_pictorialbar(name, API.get_rendering_parameters()), "象形柱状图"
- )
- @staticmethod
- @exception_catch()
- def to_scatter():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_scatter(name, API.get_rendering_parameters()), "散点图")
- @staticmethod
- @exception_catch()
- def to_line():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_line(name, API.get_rendering_parameters()), "折线图")
- @staticmethod
- @exception_catch()
- def to_bar():
- name = API.get_sheet_name_gui()
- API.new_render(machine_controller.to_bar(name, API.get_rendering_parameters()), "柱状图")
- @staticmethod
- @exception_catch()
- def update_clean_code(clean_default_script_):
- clean_code.delete("0.0", tkinter.END)
- clean_code.insert("0.0", clean_default_script_)
- @staticmethod
- @exception_catch()
- def empty_cleaning_script():
- machine_controller.del_all_clean_func()
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def execute_cleaning_script():
- name = API.get_sheet_name_gui()
- data = machine_controller.data_clean(name)
- title = f"CoTan数据处理 表格:{name}.数据清洗"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def del_cleaning_script():
- name = clean_list[API.get_clean_func_box_index_gui()]
- machine_controller.del_clean_func(name)
- API.update_cleaning_script_box()
- @staticmethod
- @exception_catch()
- def update_cleaning_script_box():
- clean_list_ = machine_controller.get_clean_func()
- clean_func_box.delete(0, tkinter.END)
- clean_func_box.insert(tkinter.END, *clean_list_)
- @staticmethod
- @exception_catch()
- def add_cleaning_script():
- exp = API.get_clean_code_gui()
- machine_controller.add_clean_func(exp)
- API.update_cleaning_script_box()
- @staticmethod
- @exception_catch()
- def clean_nan_row():
- name = API.get_sheet_name_gui()
- data = machine_controller.del_nan(name, True)
- title = f"CoTan数据处理 表格:{name}.NaN"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def is_nan():
- name = API.get_sheet_name_gui()
- data = machine_controller.is_nan(name)
- title = f"CoTan数据处理 表格:{name}.NaN"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def to_bool():
- the_bool_exp = bool_exp.get()
- name = API.get_sheet_name_gui()
- data = machine_controller.to_bool(name, the_bool_exp, True)
- title = f"CoTan数据处理 表格:{name} 布尔化"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def del_data():
- name = API.get_sheet_name_gui()
- column_, new, row_ = API.del_data_gui()
- data = "None 你的操作不被允许"
- try:
- data = machine_controller.del_slice(name, column_, row_, new)
- except BaseException:
- raise
- finally:
- title = f"CoTan数据处理 表格:{name}"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def slice_data():
- column_, is_iloc, new, row_ = API.slice_data_gui()
- name = API.get_sheet_name_gui()
- data = "None 你的操作不被允许"
- try:
- data = machine_controller.get_slice(name, column_, row_, is_iloc, new)
- except BaseException:
- raise
- finally:
- title = f"CoTan数据处理 表格:{name}"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def sample_data():
- name = API.get_sheet_name_gui()
- new = API.get_ascending_new_gui()
- data = machine_controller.sample(name, new)
- title = f"CoTan数据处理 打乱表格:{name}"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def stored_value():
- name = API.get_sheet_name_gui()
- new = API.get_ascending_new_gui()
- data = machine_controller.stored_value(name, stored_list, new)
- title = f"CoTan数据处理 表格:{name}.Stored"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def del_baseline():
- global stored_list, stored_box
- del stored_list[API.get_stored_box_index_gui()]
- API.update_sort_box_gui()
- @staticmethod
- @exception_catch()
- def add_baseline(): # 按基准列排行
- ascending, value = API.add_baseline_gui(ascending_type, sort_by)
- stored_list.append((value, ascending))
- API.update_sort_box_gui()
- @staticmethod
- @exception_catch()
- def sort_by_column(): # 行
- name = API.get_sheet_name_gui()
- new, ascending = API.sort_by_column_gui()
- data = machine_controller.sorted_index(name, False, new, ascending)
- title = f"CoTan数据处理 表格:{name}.Stored by Column"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def sort_by_tow(): # 行
- name = API.get_sheet_name_gui()
- new, ascending = API.sort_by_column_gui()
- data = machine_controller.sorted_index(name, True, new, ascending)
- title = f"CoTan数据处理 表格:{name}.Stored by Row"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def transpose():
- name = API.get_sheet_name_gui()
- new = API.get_ascending_new_gui()
- data = machine_controller.transpose(name, new)
- title = f"CoTan数据处理 表格:{name}.T"
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def show_report():
- assert not API.askokcancel_gui(f"是否统计数据,大量的数据需要耗费一定的时间(确定后,系统会在后台统计)")
- report_dir = f"{PATH}{os.sep}$Show_Des_Sheet.html"
- name = API.get_sheet_name_gui()
- assert not name is None
- machine_controller.to_report(name, report_dir)
- webbrowser.open(report_dir)
- @staticmethod
- @exception_catch()
- def show_describe():
- describe = API.get_des_bool_gui()
- name = API.get_sheet_name_gui()
- title = f"CoTan数据处理 表格:{name}_describe"
- data = str(machine_controller.describe(name, describe))
- API.vitables_gui(data, title)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def show_sheet():
- name = API.get_sheet_name_gui()
- title = f"CoTan数据处理 表格:{name}"
- data = str(machine_controller.get_sheet(name))
- API.vitables_gui(data, title)
- @staticmethod
- @exception_catch()
- def get_column(): # 列名(横行竖列,列名是上面的)
- name = API.get_sheet_name_gui()
- API.update_index_box_gui(machine_controller.get_column(name))
- @staticmethod
- @exception_catch()
- def get_row(): # 行名(横行竖列,行名左)
- name = API.get_sheet_name_gui()
- API.update_index_box_gui(machine_controller.get_index(name))
- @staticmethod
- @exception_catch()
- def show_one_sheet_html():
- global PATH, to_html_type
- html_dir = f"{PATH}{os.sep}$Show_Sheet.html"
- name = API.get_sheet_name_gui()
- assert not name is None
- machine_controller.render_html_one(name, html_dir)
- webbrowser.open(html_dir)
- @staticmethod
- @exception_catch()
- def show_sheet_html():
- global PATH, to_html_type
- html_dir = f"{PATH}{os.sep}$Show_Sheet.html"
- name = API.get_sheet_name_gui()
- assert not name is None
- machine_controller.render_html_all(name, html_dir, to_html_type.get())
- webbrowser.open(html_dir)
- @staticmethod
- @exception_catch()
- def to_csv():
- global SCREEN, sep, encoding, str_must, index_must
- csv_sep, save_dir = API.to_csv_gui()
- name = API.get_sheet_name_gui()
- machine_controller.to_csv(name, save_dir, csv_sep)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def add_csv():
- global SCREEN, sep, encoding, str_must, index_must, sheet_name
- csv_encoding, csv_sep, file_dir, index, name, str_ = API.add_csv_gui()
- machine_controller.add_csv(file_dir, name, csv_sep, csv_encoding, str_, index)
- API.update_sheet_box_gui()
- @staticmethod
- @exception_catch()
- def add_from_python():
- global SCREEN, sep, encoding, str_must, index_must
- code, name = API.add_from_python_gui()
- machine_controller.add_python(code, name)
- API.update_sheet_box_gui()
- def machine_learning(in_queue, out_queue):
- global SCREEN
- queue_controller.set_queue(in_queue, out_queue)
- queue_controller()
- SCREEN.mainloop()
- queue_controller.stop_process()
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导入CSV",
- command=API.add_csv,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导入Py",
- command=API.add_from_python,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导出CSV",
- command=API.to_csv,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="表格名称:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- sheet_name = tkinter.Entry(SCREEN, width=gui_width)
- sheet_name.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除表格",
- command=API.del_form,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看表格",
- command=API.show_sheet_html,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看单一表格",
- command=API.show_one_sheet_html,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- to_html_type = tkinter.IntVar() # 正,负,0
- lable = ["选项卡型", "可移动型", "自适应型"] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=to_html_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- str_must = tkinter.IntVar()
- index_must = tkinter.IntVar()
- row += 1
- tkinter.Label(
- SCREEN,
- text="编码方式:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- encoding = tkinter.Entry(SCREEN, width=gui_width)
- encoding.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
- buttom = tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="字符串类型",
- variable=str_must,
- )
- buttom.grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="CSV分隔符:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- sep = tkinter.Entry(SCREEN, width=gui_width)
- sep.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="重置列名",
- variable=index_must,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- sheet_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 5) # 显示符号
- sheet_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=5,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 5
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看行名",
- command=API.get_row,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看列名",
- command=API.get_column,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="显示表格",
- command=API.show_sheet,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="最大显示行数:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- max_row = tkinter.Entry(SCREEN, width=gui_width * 2)
- max_row.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="最大显示列数:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- max_column = tkinter.Entry(SCREEN, width=gui_width * 2)
- max_column.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- # Row与Column Row是横行,tkinter布局中Row变大,表示所在行数变大,向下移动如:
- # 1,2,3,4,5,6
- # 7,8,9,a,b,c
- # 其中数字1-6是第一行,1-c是第二行,第二行在第一行下面,row变大向下移动(Row是横向行而不是横向移动) to 搞不清楚横行竖列的人
- row += 1
- index_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 10) # 显示符号
- index_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=10,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 10
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看数据分析",
- command=API.show_report,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="简单数据统计",
- command=API.show_describe,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- des_bool = tkinter.IntVar() # 是否启用
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="生成统计表格",
- variable=des_bool,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Label(
- SCREEN,
- text="【数据清洗】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- column_clist = []
- row_clist = []
- label = ["启始(列号):", "终止(列):", "间隔(列):"]
- for i in range(3):
- row += 1
- tkinter.Label(
- SCREEN,
- text=label[i],
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- column_clist.append(tkinter.Entry(SCREEN, width=gui_width * 2))
- column_clist[-1].grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.W + tkinter.E
- )
- label = ["启始(行号):", "终止(行):", "间隔(行):"]
- for i in range(3):
- row += 1
- tkinter.Label(
- SCREEN,
- text=label[i],
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- row_clist.append(tkinter.Entry(SCREEN, width=gui_width * 2))
- row_clist[-1].grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.W + tkinter.E
- )
- row += 1
- column_type = tkinter.IntVar()
- lable = ["根据列号", "根据列名", "输入列号"] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=column_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- row += 1
- row_type = tkinter.IntVar()
- lable = ["根据行号", "根据行名", "输入行号"] # 复选框
- for i in range(3):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=row_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- row += 1
- slice_new = tkinter.IntVar()
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="切片选定",
- command=API.slice_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除选定",
- command=API.del_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="生成新表格",
- variable=slice_new,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="布尔逻辑:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- bool_exp = tkinter.Entry(SCREEN, width=gui_width * 2)
- bool_exp.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.W + tkinter.E)
- row += 1
- tkinter.Label(
- SCREEN,
- text="操作的列号:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- drop_column = tkinter.Entry(SCREEN, width=gui_width * 2)
- drop_column.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.W + tkinter.E)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成布尔表格",
- command=API.to_bool,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看空值",
- command=API.is_nan,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="清洗空值(按行)",
- command=API.clean_nan_row,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="添加执行方法",
- command=API.add_cleaning_script,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除执行方法",
- command=API.del_cleaning_script,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="数据特征提取",
- command=API.feature_extraction,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- clean_func_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 2)
- clean_func_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 2
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看词典",
- command=API.show_dictionary_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="恢复显示",
- command=API.reset_clean_code_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="执行数据清洗",
- command=API.execute_cleaning_script,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- clean_code = tkinter.Text(SCREEN, width=gui_width * 3, height=gui_height * 7)
- clean_code.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=7,
- sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S,
- )
- clean_code.insert("0.0", clean_default_script)
- row += 7
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="清空执行方法",
- command=API.empty_cleaning_script,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看执行方法",
- command=API.view_cleaning_script_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导入执行方法",
- command=API.open_python_for_clean_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Label(
- SCREEN,
- text="【数据可视化】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成柱状图",
- command=API.to_bar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成3D柱状图",
- command=API.to_bar3d,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成折线图",
- command=API.to_line,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成3D折线图",
- command=API.to_line3d,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成象形柱状图",
- command=API.to_pictorialbar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成散点图",
- command=API.to_scatter,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成3D散点图",
- command=API.to_scatter3d,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成箱形图",
- command=API.to_boxpolt,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成漏斗图",
- command=API.to_funnel,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成热力图",
- command=API.to_heat_map,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成饼图",
- command=API.to_pie,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成多轴图",
- command=API.to_parallel,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成极坐标图",
- command=API.to_polar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成雷达图",
- command=API.to_radar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成词云",
- command=API.to_word_cloud,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成关系图",
- command=API.to_format_graph,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成XY关系图",
- command=API.to_graph,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成水球图",
- command=API.to_liquid,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成仪表图",
- command=API.to_gauge,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成日历图",
- command=API.to_calendar,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成河流图",
- command=API.to_theme_river,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成旭日图",
- command=API.to_sunburst,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成桑基图",
- command=API.to_sankey,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成树状图",
- command=API.to_tree,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成矩形树图",
- command=API.to_treemap,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成Map地图",
- command=API.to_map,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成Geo点地图",
- command=API.to_scattergeo,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成Geo地图",
- command=API.to_geo,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="选择底图",
- command=API.add_basemap,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="选择顶图",
- command=API.add_top_image,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="生成层叠图",
- command=API.make_overlap,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- overlap_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 2)
- overlap_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="渲染HTML",
- command=API.rendering,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="单独渲染HTML",
- command=API.rendering_one,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除渲染",
- command=API.del_rendering,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- render_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height)
- render_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 2
- draw_as_well = tkinter.IntVar()
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="清空渲染",
- command=API.clear_rendering,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导入渲染",
- command=API.python_render,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="马上渲染",
- variable=draw_as_well,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- rendering_parameters = tkinter.Text(SCREEN, width=gui_width * 3, height=gui_height * 7)
- rendering_parameters.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=7,
- sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S,
- )
- row += 7
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看词典",
- command=API.show_dictionary_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="恢复显示",
- command=API.show_tips_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- columnspan=2,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Label(
- SCREEN,
- text="【行名与列名】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- replace_index = tkinter.IntVar()
- lable = ["(列数据)调整行名", "(行数据)调整列名"] # 复选框
- for i in range(2):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=replace_index,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="植入行(列)号",
- command=API.num_with_name,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- row += 1
- replace_type = []
- lable = ["保留原值", "保留新值"] # 复选框
- for i in range(2):
- replace_type.append(tkinter.IntVar())
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=replace_type[-1],
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="统一行(列)号",
- command=API.num_to_name,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="替换字典:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- replace_dict = tkinter.Entry(SCREEN, width=gui_width * 2)
- replace_dict.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="替换列(行):",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- replace_iloc = tkinter.Entry(SCREEN, width=gui_width * 2)
- replace_iloc.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="执行替换已有列(行)操作",
- command=API.change_index,
- font=FONT,
- width=gui_width * 2,
- height=gui_height,
- ).grid(column=column, columnspan=2, row=row, sticky=tkinter.E + tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="执行替换操作",
- command=API.replace_index_func,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- label = ["起点", "终点", "间隔"]
- date_input = []
- for i in range(3):
- row += 1
- tkinter.Label(
- SCREEN,
- text="时间序列" + label[i],
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- date_input.append(tkinter.Entry(SCREEN, width=gui_width * 2))
- date_input[-1].grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- date_type = tkinter.IntVar()
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="刷入Date序列",
- command=API.date_index,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row, sticky=tkinter.E + tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="刷入Time序列",
- command=API.time_index,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="使用间隔",
- variable=date_type,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="【数据类型管理】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- tkinter.Label(
- SCREEN,
- text="修改(列号):",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- dtype_column = tkinter.Entry(SCREEN, width=gui_width * 2)
- dtype_column.grid(
- column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="数据类型:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- dtype_input = tkinter.Entry(SCREEN, width=gui_width * 2)
- dtype_input.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="错误值:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- dtype_wrong = tkinter.Entry(SCREEN, width=gui_width * 2)
- dtype_wrong.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="执行转换",
- command=API.set_dtype,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- dtype_func = tkinter.IntVar() # 正,负,0
- lable = ["硬转换", "软转换"] # 复选框
- for i in range(2):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=dtype_func,
- value=i,
- ).grid(column=column + 1 + i, row=row, sticky=tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="【排序操作】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column, columnspan=3, row=row
- ) # 设置说明
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text=".T",
- command=API.transpose,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="按行名排序",
- command=API.sort_by_tow,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="按列名排序",
- command=API.sort_by_column,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="基准列(列号):",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column, row=row
- ) # 设置说明
- sort_by = tkinter.Entry(SCREEN, width=gui_width + 2)
- sort_by.grid(column=column + 1, row=row, sticky=tkinter.W)
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="按数据排序",
- command=API.stored_value,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- ascending_type = tkinter.IntVar()
- ascending_new = tkinter.IntVar()
- lable = ["正序排列", "倒序排列"] # 复选框
- for i in range(2):
- tkinter.Radiobutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text=lable[i],
- variable=ascending_type,
- value=i,
- ).grid(column=column + i, row=row, sticky=tkinter.W)
- tkinter.Checkbutton(
- SCREEN,
- bg=bg_color,
- fg=word_color,
- activebackground=bg_color,
- activeforeground=word_color,
- selectcolor=bg_color,
- text="生成新表格",
- variable=ascending_new,
- ).grid(column=column + 2, row=row, sticky=tkinter.W)
- row += 1
- stored_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 4) # 显示符号
- stored_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=5,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 5
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="添加基准",
- command=API.add_baseline,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除基准",
- command=API.del_baseline,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="打乱表格",
- command=API.sample_data,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- column += 3
- tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
- column=column, row=row
- ) # 设置说明
- column += 1
- row = 0
- tkinter.Label(
- SCREEN,
- text="【机器学习】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- chose_learner = tkinter.StringVar()
- put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=chose_learner)
- put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- put["state"] = "readonly"
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="选用学习器",
- command=API.set_learner_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
- row += 1
- tkinter.Label(
- SCREEN,
- text="测试数据分割:",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(column=column, row=row)
- data_split = tkinter.Entry(SCREEN, width=gui_width * 2)
- data_split.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
- row += 1
- learner_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 5)
- learner_box.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=5,
- sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 5
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="导入学习器",
- command=API.rendering,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="查看数据",
- command=API.visual_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="删除学习器",
- command=API.del_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="训练机器",
- command=API.fit_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="测试机器",
- command=API.test_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="数据预测",
- command=API.predict_learner,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Label(
- SCREEN,
- text="【学习器选择和配置】",
- bg=bg_color,
- fg=word_color,
- font=FONT,
- width=gui_width * 3,
- height=gui_height,
- ).grid(
- column=column,
- columnspan=3,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- ) # 设置说明
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="线性回归",
- command=API.add_generalized_linear,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="岭回归",
- command=API.add_ridge,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="Lasso",
- command=API.add_lasso,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="逻辑回归",
- command=API.add_logistic_regression,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="决策树",
- command=API.show_sorry_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="SVM",
- command=API.show_sorry_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="朴素贝叶斯",
- command=API.show_sorry_gui,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="K邻近分类",
- command=API.add_knn_regression,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 1,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- tkinter.Button(
- SCREEN,
- bg=buttom_bg_color,
- fg=word_color,
- text="K邻近预测",
- command=API.add_knn_class,
- font=FONT,
- width=gui_width,
- height=gui_height,
- ).grid(
- column=column + 2,
- row=row,
- sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
- )
- row += 1
- learner_parameters = tkinter.Text(SCREEN, width=gui_width * 3, height=gui_height * 11)
- learner_parameters.grid(
- column=column,
- row=row,
- columnspan=3,
- rowspan=11,
- sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S,
- )
|