def display_system_chapters_taskbar(): """ * -------------------------------------------------------------------------- * function : display system taskbar * * parms : * N/A * * returns : N/A * -------------------------------------------------------- """ print("\n") dfc_utils_modules_checkbox = CheckboxGroupForm( dfc_utils_modules_checkbox_id, dfc_utils_modules_checkbox_idList, dfc_utils_modules_checkbox_labelList, dfc_utils_modules_checkbox_jsList, get_current_checkboxes(sysm.UTILITIES)) if (not (cfg.get_dfc_mode() == cfg.INLINE_MODE)): dfc_utils_modules_checkbox.set_rows_count([2, 2, 1]) dfc_utils_modules_heading_html = "<div>dfcleanser Utilities</div><br>" dfc_utils_modules_checkbox_html = dfc_utils_modules_checkbox.get_html() gridclasses = ["dfcleanser-common-grid-header", "dfc-main"] gridhtmls = [ dfc_utils_modules_heading_html, dfc_utils_modules_checkbox_html ] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("dfcleanser-chapters-wrapper", gridclasses, gridhtmls) else: display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls, True) dfc_script_modules_tb = ButtonGroupForm(system_chapters_tb_doc_id, system_chapters_tb_keyTitleList, system_chapters_tb_jsList, system_chapters_tb_centered) dfc_script_modules_tb.set_gridwidth(480) dfc_script_modules_tb.set_custombwidth(160) dfc_script_modules_tb_html = dfc_script_modules_tb.get_html() gridclasses = ["dfc-footer"] gridhtmls = [dfc_script_modules_tb_html] display_generic_grid("dfcleanser-chapters-tb-wrapper", gridclasses, gridhtmls) print("\n")
def display_inspect_outliers(colname): """ * -------------------------------------------------------------------------- * function : display the inspect outliers option * * parms : * * returns : * N/A * -------------------------------------------------------- """ opstat = opStatus() display_inspect_cols(colname) outliers_html = diw.get_simple_outliers(cfg.get_current_chapter_df( cfg.DataInspection_ID), colname, opstat, display=False) gridclasses = ["dfc-main"] gridhtmls = [outliers_html] print("\n") if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("df-inspection-outliers-data-wrapper", gridclasses, gridhtmls) else: display_generic_grid("df-inspection-outliers-pop-up-data-wrapper", gridclasses, gridhtmls)
def display_df_dataframes(title): """ * -------------------------------------------------------------------------- * function : display dataframe manager form * * parms : * N/A * * returns : N/A * -------------------------------------------------------- """ dfmgr_input_html = get_df_list_html(title) dfmgr_heading_html = "<div>Current dfCleanser dataframes </div>" gridclasses = ["dfcleanser-common-grid-header", "dfc-main"] gridhtmls = [dfmgr_heading_html, dfmgr_input_html] print("\n") if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls) else: display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls, True) from dfcleanser.common.display_utils import display_pop_up_buffer display_pop_up_buffer()
def display_system_main_taskbar(): if (cfg.get_dfc_mode() == cfg.INLINE_MODE): from dfcleanser.common.display_utils import display_dfcleanser_taskbar display_dfcleanser_taskbar( ButtonGroupForm(system_environment_doc_id, system_environment_keyTitleList, system_environment_jsList, system_environment_centered)) else: system_tb_A = ButtonGroupForm(system_environmentA_doc_id, system_environmentA_keyTitleList, system_environmentA_jsList, system_environmentA_centered) system_tb_A.set_gridwidth(480) system_tb_A_html = system_tb_A.get_html() system_tb_B = ButtonGroupForm(system_environmentB_doc_id, system_environmentB_keyTitleList, system_environmentB_jsList, system_environmentB_centered) system_tb_B.set_gridwidth(480) system_tb_B_html = system_tb_B.get_html() gridclasses = ["dfc-top-", "dfc-footer"] gridhtmls = [system_tb_A_html, system_tb_B_html] display_generic_grid("dfcleanser-system-tb-pop-up-wrapper", gridclasses, gridhtmls)
def display_offline(): """ * -------------------------------------------------------------------------- * function : display offline toggle mode * * parms : * N/A * * returns : N/A * -------------------------------------------------------- """ from dfcleanser.common.html_widgets import InputForm dfmanager_input_form = InputForm( dfmgr_offline_input_id, dfmgr_offline_input_idList, dfmgr_offline_input_labelList, dfmgr_offline_input_typeList, dfmgr_offline_input_placeholderList, dfmgr_offline_input_jsList, dfmgr_offline_input_reqList) selectDicts = [] if (sysm.get_dfc_run_offline_status()): stat = "True" else: stat = "False" offline_mode = {"default": stat, "list": ["False", "True"]} selectDicts.append(offline_mode) get_select_defaults(dfmanager_input_form, dfmgr_offline_input_id, dfmgr_offline_input_idList, dfmgr_offline_input_typeList, selectDicts) dfmanager_input_form.set_shortForm(True) dfmanager_input_form.set_gridwidth(480) dfmanager_input_form.set_custombwidth(100) dfmanager_input_form.set_fullparms(True) dfmgr_input_html = dfmanager_input_form.get_html() dfmgr_heading_html = "<div>Run dfc Offline Manager</div>" gridclasses = ["dfcleanser-common-grid-header", "dfc-main"] gridhtmls = [dfmgr_heading_html, dfmgr_input_html] print("\n") if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls) else: display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls, True) from dfcleanser.common.display_utils import display_pop_up_buffer display_pop_up_buffer()
def display_export_main_taskbar(): from dfcleanser.common.display_utils import display_dfcleanser_taskbar if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_dfcleanser_taskbar( ButtonGroupForm(export_task_bar_id, export_task_bar_keyTitleList, export_task_bar_jsList, export_task_bar_centered)) else: display_dfcleanser_taskbar( ButtonGroupForm(export_task_bar_id, export_task_bar_pu_keyTitleList, export_task_bar_jsList, export_task_bar_centered))
def display_add_df_input(): """ * -------------------------------------------------------------------------- * function : add a dataframe to the dfc list * * parms : * * returns : N/A * -------------------------------------------------------- """ from dfcleanser.common.html_widgets import InputForm dfmanager_input_form = InputForm( dfmgr_add_input_id, dfmgr_add_input_idList, dfmgr_add_input_labelList, dfmgr_add_input_typeList, dfmgr_add_input_placeholderList, dfmgr_add_input_jsList, dfmgr_add_input_reqList) dfmanager_input_form.set_shortForm(True) dfmanager_input_form.set_gridwidth(480) dfmanager_input_form.set_custombwidth(70) dfmanager_input_form.set_fullparms(True) dfmgr_input_html = dfmanager_input_form.get_html() dfmgr_heading_html = "<div>Add df to dfc dataframe Manager</div>" gridclasses = ["dfcleanser-common-grid-header", "dfc-main"] gridhtmls = [dfmgr_heading_html, dfmgr_input_html] print("\n") if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls) else: display_generic_grid("dfc-common-480px-2-vert-wrapper", gridclasses, gridhtmls, True) from dfcleanser.common.display_utils import display_pop_up_buffer display_pop_up_buffer()
def show_sys_info(): """ * -------------------------------------------------------------------------- * function : display dfcleanser system info * * parms : * N/A * * returns : N/A * -------------------------------------------------------- """ title = "Installed Python Info" ptitles = ["Version", "API", "Info"] pvalues = [ str(get_python_version()), str(sys.api_version), str(sys.version_info) ] parms_html = displayParms(title, ptitles, pvalues, cfg.System_ID, None, 0, False, 11) notes_html = show_setup_notes() libs_html = show_libs_info() libs_notes_html = show_libs_notes() gridclasses = ["dfc-header", "dfc-top", "dfc-bottom", "dfc-footer"] gridhtmls = [parms_html, notes_html, libs_html, libs_notes_html] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("df-sys-info-wrapper", gridclasses, gridhtmls) else: display_generic_grid("df-sys-info-pop-up-wrapper", gridclasses, gridhtmls) from dfcleanser.common.display_utils import display_pop_up_buffer display_pop_up_buffer()
def display_inspect_cols(parms): """ * -------------------------------------------------------------------------- * function : display the inspect cols option * * parms : * * returns : * N/A * -------------------------------------------------------- """ opstat = opStatus() clock = RunningClock() clock.start() try: df = cfg.get_current_chapter_df(cfg.DataInspection_ID) colnames = df.columns.tolist() if (not (parms is None)): colname = parms else: colname = colnames[0] cnames = { 'default': colname, 'list': colnames, "callback": "change_inspect_cols_col", "size": 10 } if (is_numeric_col(df, colname)): coldetails_form = InputForm(diw.inspect_col_input_id, diw.inspect_col_input_idList, diw.inspect_col_input_labelList, diw.inspect_col_input_typeList, diw.inspect_col_input_placeholderList, diw.inspect_col_input_jsList, diw.inspect_col_input_reqList) else: coldetails_form = InputForm( diw.inspect_nn_col_input_id, diw.inspect_nn_col_input_idList, diw.inspect_nn_col_input_labelList, diw.inspect_nn_col_input_typeList, diw.inspect_nn_col_input_placeholderList, diw.inspect_nn_col_input_jsList, diw.inspect_nn_col_input_reqList) selectDicts = [] selectDicts.append(cnames) get_select_defaults(coldetails_form, diw.inspect_col_input_id, diw.inspect_col_input_idList, diw.inspect_col_input_typeList, selectDicts) coldetails_form.set_shortForm(True) coldetails_form.set_fullparms(True) if (cfg.get_dfc_mode() == cfg.INLINE_MODE): coldetails_form.set_gridwidth(360) if (is_numeric_col(df, colname)): coldetails_form.set_buttonstyle({ "font-size": 12, "height": 75, "width": 85, "left-margin": 2 }) else: coldetails_form.set_buttonstyle({ "font-size": 12, "height": 75, "width": 85, "left-margin": 75 }) else: coldetails_form.set_gridwidth(480) if (is_numeric_col(df, colname)): coldetails_form.set_buttonstyle({ "font-size": 12, "height": 75, "width": 110, "left-margin": 2 }) else: coldetails_form.set_buttonstyle({ "font-size": 12, "height": 75, "width": 110, "left-margin": 110 }) coldetails_html = coldetails_form.get_html() from dfcleanser.data_cleansing.data_cleansing_widgets import display_col_stats col_stats_html = display_col_stats(df, colname, False, True) gridclasses = ["dfc-left", "dfc-right"] gridhtmls = [col_stats_html, coldetails_html] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("df-inspection-column-data-wrapper", gridclasses, gridhtmls) else: display_generic_grid("df-inspection-pop-up-column-data-wrapper", gridclasses, gridhtmls) except Exception as e: opstat.store_exception("Error displaying column data\n ", e) clock.stop() if (not (opstat.get_status())): display_exception(opstat)
def display_inspect_rows(rowid=0): """ * -------------------------------------------------------------------------- * function : display the inspect rows option * * parms : * * returns : * N/A * -------------------------------------------------------- """ opstat = opStatus() clock = RunningClock() clock.start() try: print("\n") from dfcleanser.data_transform.data_transform_dataframe_widgets import display_current_df_index display_current_df_index( cfg.get_current_chapter_df(cfg.DataInspection_ID), cfg.get_current_chapter_dfc_df_title(cfg.DataInspection_ID), 0, True) row_stats_html = diw.display_row_stats( cfg.get_current_chapter_df(cfg.DataInspection_ID), cfg.get_config_value(cfg.CURRENT_INSPECTION_DF), False) sample_row_html = dim.display_df_rows( cfg.get_current_chapter_df(cfg.DataInspection_ID), rowid, 200) rows_openexcel_tb = diw.get_inspection_openexcel_taskbar() rows_openexcel_tb.set_gridwidth(620) rows_openexcel_tb.set_customstyle({ "font-size": 13, "height": 90, "width": 120, "left-margin": 10 }) rows_openexcel_html = rows_openexcel_tb.get_html() rows_openexcel_html = (rows_openexcel_html + "<br>") cfg.set_config_value(cfg.CURRENT_SCROLL_ROW_KEY, rowid) gridclasses = ["dfc-top", "dfc-bottom", "dfc-footer"] gridhtmls = [row_stats_html, sample_row_html, rows_openexcel_html] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("df-inspection-row-data-wrapper", gridclasses, gridhtmls) else: display_generic_grid("df-inspection-row-data-pop-up-wrapper", gridclasses, gridhtmls) except Exception as e: opstat.store_exception("Error displaying row data\n ", e) display_exception(opstat) import traceback traceback.print_exc() clock.stop()
def display_inspect_datatypes(option, df_data_info): """ * -------------------------------------------------------------------------- * function : display the datatypes option * * parms : * * returns : * N/A * -------------------------------------------------------- """ opstat = opStatus() import matplotlib.pyplot as plt clock = RunningClock() clock.start() try: if (not (option == dim.DISPLAY_FULL_COLUMN_NAMES)): data_types_table = dcTable("Column Data Types", "datatypesTable", cfg.DataInspection_ID) else: data_types_table = None data_types_html = diw.display_df_datatypes(data_types_table, df_data_info[0], df_data_info[1], df_data_info[2], option, False) gridclasses = ["dfc-main"] gridhtmls = [data_types_html] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("df-inspection-wrapper", gridclasses, gridhtmls) else: display_generic_grid("df-inspection-pop-up-wrapper", gridclasses, gridhtmls) print("\n") import matplotlib.pyplot as plt import numpy as np font = {'fontsize': 14} font2 = {'fontsize': 18} objects = [] for i in range(len(df_data_info[0])): ttype = str(df_data_info[0][i]) ttype = ttype.replace("datetime.", "") objects.append(ttype) y_pos = np.arange(len(objects)) plt.bar(y_pos, df_data_info[1], align='center', alpha=0.5, color='#428bca') plt.xticks(y_pos, objects, rotation='vertical') plt.ylabel('Type Counts', fontdict=font) plt.xlabel('Data Types', fontdict=font) plt.title('Column Data Types', fontdict=font2) plt.show() except Exception as e: opstat.store_exception("Error displaying data types\n ", e) clock.stop() if (not (opstat.get_status())): display_exception(opstat)
def show_libs_info(): """ * -------------------------------------------------------------------------- * function : display dfcleanser libs info * * parms : * N/A * * returns : N/A * -------------------------------------------------------- """ clock = RunningClock() clock.start() libsHeader = [ "Lib Name", "Tested</br>With</br>Version", "Installed</br>Version" ] libsRows = [] libsWidths = [40, 30, 30] libsAligns = ["left", "center", "center"] testedModules = [ "Python", "IPython", "ipywidgets", "ipykernel", "notebook", "pandas", "sklearn", "matplotlib", "numpy", "scipy", "json", "SQLAlchemy", "pymysql", "mysql-connector-python", "pyodbc", "pymssql", "SQLite3", "psycopg2", "cx-oracle", "geopy", "googlemaps", "arcgis" ] testedmoduleVersions = [ "3.7.3", "7.4.0", "7.4.2", "5.1.0", "5.7.8", "0.24.2", "0.20.3", "3.0.3", "1.16.2", "1.2.1", "2.0.9", "1.3.1", "0.9.3", "8.0.16", "4.0.26", "2.1.4", "3.8.6", "2.8.2", "7.1.3", "1.19.0", "2.5.1", "1.6.1" ] installedmoduleVersions = [] installedmoduleVersions.append(str(get_python_version())) import IPython installedmoduleVersions.append(str(IPython.__version__)) try: import ipywidgets installedmoduleVersions.append(str(ipywidgets.__version__)) except: installedmoduleVersions.append(str("-1")) try: import ipykernel installedmoduleVersions.append(str(ipykernel.__version__)) except: installedmoduleVersions.append(str("-1")) try: import notebook installedmoduleVersions.append(str(notebook.__version__)) except: installedmoduleVersions.append(str("-1")) try: import pandas installedmoduleVersions.append(str(pandas.__version__)) except: installedmoduleVersions.append(str("-1")) try: import sklearn installedmoduleVersions.append(str(sklearn.__version__)) except: installedmoduleVersions.append(str("-1")) try: import matplotlib installedmoduleVersions.append(str(matplotlib.__version__)) except: installedmoduleVersions.append(str("-1")) try: import numpy installedmoduleVersions.append(str(numpy.__version__)) except: installedmoduleVersions.append(str("-1")) try: import scipy installedmoduleVersions.append(str(scipy.__version__)) except: installedmoduleVersions.append(str("-1")) try: import json installedmoduleVersions.append(str(json.__version__)) except: installedmoduleVersions.append(str("-1")) try: import sqlalchemy installedmoduleVersions.append(str(sqlalchemy.__version__)) except: installedmoduleVersions.append(str("-1")) try: import pymysql installedmoduleVersions.append(str(pymysql.__version__)) except: installedmoduleVersions.append(str("-1")) try: import mysql.connector installedmoduleVersions.append(str(mysql.connector.__version__)) except: installedmoduleVersions.append(str("-1")) #import pyodbc installedmoduleVersions.append(str("unknown")) try: import pymssql installedmoduleVersions.append(str(pymssql.__version__)) except: installedmoduleVersions.append(str("-1")) #import sqlite3 installedmoduleVersions.append(str("unknown")) try: import psycopg2 pgversion = str(psycopg2.__version__) found = pgversion.find("(") if (found > 0): installedmoduleVersions.append(pgversion[0:found - 1]) else: installedmoduleVersions.append(pgversion) except: installedmoduleVersions.append(str("-1")) try: import cx_Oracle installedmoduleVersions.append(str(cx_Oracle.__version__)) except: installedmoduleVersions.append(str("-1")) try: import geopy installedmoduleVersions.append(str(geopy.__version__)) except: installedmoduleVersions.append(str("-1")) try: import googlemaps installedmoduleVersions.append(str(googlemaps.__version__)) except: installedmoduleVersions.append(str("-1")) try: import arcgis installedmoduleVersions.append(str(arcgis.__version__)) except: installedmoduleVersions.append(str("-1")) for i in range(len(testedModules)): libsrow = [] libsrow.append(str(testedModules[i])) libsrow.append(str(testedmoduleVersions[i])) if (installedmoduleVersions[i] == "-1"): installedmoduleVersions[i] = "not installed" libsrow.append(str(installedmoduleVersions[i])) libsRows.append(libsrow) colorList = [] for i in range(len(testedModules)): colorRow = [] if (installedmoduleVersions[i] == "not installed"): colorRow = [sysm.Yellow, sysm.Yellow, sysm.Red] elif (installedmoduleVersions[i] == "unknown"): colorRow = [sysm.Green, sysm.Green, sysm.Yellow] elif (testedmoduleVersions[i] > installedmoduleVersions[i]): colorRow = [sysm.Red, sysm.Red, sysm.Red] elif (testedmoduleVersions[i] < installedmoduleVersions[i]): colorRow = [sysm.Yellow, sysm.Yellow, sysm.Yellow] else: colorRow = [sysm.Green, sysm.Green, sysm.Green] colorList.append(colorRow) libs_table = dcTable("Python Libraries", "dcmodsTable", cfg.System_ID, libsHeader, libsRows, libsWidths, libsAligns) libs_table.set_tabletype(SIMPLE) libs_table.set_rowspertable(len(testedModules)) libs_table.set_color(True) libs_table.set_colorList(colorList) libs_table.set_small(True) if (cfg.get_dfc_mode() == cfg.INLINE_MODE): libs_table.set_smallwidth(99) libs_table.set_smallmargin(2) else: libs_table.set_smallwidth(98) libs_table.set_smallmargin(2) libs_table.set_checkLength(False) libs_table.set_border(False) clock.stop() return (libs_table.get_html())
def display_dc_export_forms(exid, detid=0, notes=False): """ * -------------------------------------------------------------------------- * function : display pandas export input forms * * parms : * exid - export type * detid - detail id * notes - notes flag * * returns : N/A * -------------------------------------------------------- """ clear_output() # add the main import task bar if (exid == dem.EXPORT_TB_ONLY): display_export_main_taskbar() cfg.display_data_select_df(cfg.DataExport_ID) else: if (cfg.is_a_dfc_dataframe_loaded()): # add the pandas import task bar or pandas details form if ((exid == dem.EXPORT_PANDAS_TB_ONLY) or (exid == dem.EXPORT_PANDAS_TB_PLUS_DETAILS)): # add the pandas export details form if (exid == dem.EXPORT_PANDAS_TB_PLUS_DETAILS): if (detid == dem.SQLTABLE_EXPORT): import dfcleanser.common.db_utils as dbutils cfg.drop_config_value(pandas_export_sqltable_id + "Parms") dbid = cfg.get_config_value(cfg.CURRENT_DB_ID_KEY) if (dbid == None): cfg.set_config_value(cfg.CURRENT_DB_ID_KEY, dbutils.MySql) conparms = cfg.get_config_value( dbutils.MYSQL_DBCON_PARMS) if (conparms == None): conparms = [ "", "", "", "", dbutils.pymysql_library ] elif (dbid == dbutils.MySql): conparms = cfg.get_config_value( dbutils.MYSQL_DBCON_PARMS) if (conparms == None): conparms = [ "", "", "", "", dbutils.pymysql_library ] elif (dbid == dbutils.MS_SQL_Server): conparms = cfg.get_config_value( dbutils.MSSQL_DBCON_PARMS) if (conparms == None): conparms = [ "", "", "", "", dbutils.pyodbc_library ] elif (dbid == dbutils.SQLite): conparms = cfg.get_config_value( dbutils.SQLITE_DBCON_PARMS) if (conparms == None): conparms = ["", dbutils.sqlite3_library] elif (dbid == dbutils.Postgresql): conparms = cfg.get_config_value( dbutils.POSTGRESQL_DBCON_PARMS) if (conparms == None): conparms = [ "", "", "", "", dbutils.psycopg2_library ] elif (dbid == dbutils.Oracle): conparms = cfg.get_config_value( dbutils.ORACLE_DBCON_PARMS) if (conparms == None): conparms = [ "", "", "", dbutils.cx_oracle_library ] elif (dbid == dbutils.Custom): conparms = cfg.get_config_value( dbutils.CUSTOM_DBCON_PARMS) if (conparms == None): conparms = [""] dbutils.display_db_connector_inputs( cfg.get_config_value(cfg.CURRENT_DB_ID_KEY), conparms, dbutils.SQL_EXPORT) else: display_export_main_taskbar() pandas_export_form = get_pandas_export_input_form( detid) if (cfg.get_dfc_mode() == cfg.INLINE_MODE): pandas_export_form.set_shortForm(True) pandas_export_form.set_gridwidth(640) pandas_export_form.set_custombwidth(110) else: pandas_export_form.set_gridwidth(480) pandas_export_form.set_custombwidth(100) pandas_input_html = "" pandas_input_html = pandas_export_form.get_html() pandas_input_heading_html = "<div>" + get_pandas_export_input_title( detid) + "</div>" gridclasses = [ "dfcleanser-common-grid-header", "dfc-footer" ] gridhtmls = [ pandas_input_heading_html, pandas_input_html ] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("data-import-wrapper", gridclasses, gridhtmls) else: display_generic_grid("data-import-pop-up-wrapper", gridclasses, gridhtmls) else: display_pandas_export_taskbar() elif (exid == dem.EXPORT_CUSTOM_ONLY): print("dem.EXPORT_PANDAS_TB_ONLY") # add the custom import form exportCustomDetailsForm = InputForm( custom_export_id, custom_export_idList, custom_export_labelList, custom_export_typeList, custom_export_placeholderList, custom_export_jsList, custom_export_reqList) if (notes): customNotes = [ "To create custom export code in the code cell below hit 'New Custom Export'", " (enter and test export in the code cell below)", " (leave the '# custom export' comment line in the code cell", " (call dfcleanser.common.cfg.get_dfc_dataframe_df() to get the current dataframe)", "To run the export code in the Custom Export Code box hit 'Run Custom Export' button", " (only the code in the Custom Export Code box is run and stored for scripting)", "Once import successful hit 'Save Custom Import' button to store import code for future retrieval", "To drop the custom export code and clear the Custom Export Code box hit 'Drop Custom Export' button" ] print("\n") display_inline_help(customNotes, 92) selectDicts = [] df_list = cfg.get_dfc_dataframes_select_list(cfg.DataExport_ID) selectDicts.append(df_list) flags = {"default": "False", "list": ["True", "False"]} selectDicts.append(flags) get_select_defaults(exportCustomDetailsForm, custom_export_id, custom_export_idList, custom_export_typeList, selectDicts) if (cfg.get_dfc_mode() == cfg.INLINE_MODE): exportCustomDetailsForm.set_shortForm(True) exportCustomDetailsForm.set_gridwidth(640) exportCustomDetailsForm.set_custombwidth(110) else: exportCustomDetailsForm.set_gridwidth(480) exportCustomDetailsForm.set_custombwidth(100) exportCustomDetailsForm.set_fullparms(True) from dfcleanser.common.html_widgets import new_line custom_code = "# add USER CODE to export the df" + new_line + new_line custom_code = ( custom_code + "from dfcleanser.common.cfg import get_dfc_dataframe" + new_line) custom_code = (custom_code + "df = get_dfc_dataframe_df(dataframe_title)" + new_line + new_line) custom_code = (custom_code + "# USER CODE" + new_line) cfg.set_config_value(custom_export_id + "Parms", ["", custom_code, ""]) custom_export_html = "" custom_export_html = exportCustomDetailsForm.get_html() custom_export_heading_html = "<div>Custom Export</div><br>" gridclasses = ["dfcleanser-common-grid-header", "dfc-footer"] gridhtmls = [custom_export_heading_html, custom_export_html] if (cfg.get_dfc_mode() == cfg.INLINE_MODE): display_generic_grid("data-import-wrapper", gridclasses, gridhtmls) else: display_generic_grid("data-import-pop-up-wrapper", gridclasses, gridhtmls) else: display_export_main_taskbar() cfg.display_data_select_df(cfg.DataExport_ID) cfg.display_no_dfs(cfg.DataExport_ID)