raw_connection () except ValueError : print ( 'You have connection problem with Mysql, check engine parameters' ) cur = conn. dtypes ) sql += ", " + str ( i ) + ' ' + map_data sql = sql + str ( ')' ) print ( ' \n ', sql, ' \n ' ) try : conn = engine. columns )] map_data = dtype_mapping () for i in col_list_dtype : key = str ( df ]. Outputs Mysql schema creation''' df = rename_df_cols ( df ) col_list_dtype =. rename ( columns = col_no_space, index = str, inplace = True ) return df def dtype_mapping (): '''Returns a dict to refer correct data type for mysql''' return #engine = def create_sql ( engine, df, sql = initial_sql ): '''input engine: engine (connection for mysql), df: dataframe that you would like to create a schema for, replace ( ' ', '' )) for i in list ( df. Sql_table_name = 'provider' initial_sql = "CREATE TABLE IF NOT EXISTS " + str ( sql_table_name ) + "(key_pk INT AUTO_INCREMENT PRIMARY KEY" def rename_df_cols ( df ): '''Input a dataframe, outputs same dataframe with No Space in column names''' col_no_space = dict (( i, i. ![]() Group Reassignments and Physician Assistants
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |