Open JungHulk opened 1 year ago
Unit conv
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 26 08:55:44 2023
@author: seungj.jung
"""
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 19 15:39:48 2023
@author: seungj.jung
"""
#### Excel Data base 만들기
import os
import pandas as pd
import pickle
import numpy as np
# excel = Dispatch('excel.Application') # win32com.client로 excel call
openfiledir = os.getcwd() + '\\' # 현재 폴더 위치
filename = 'Unitconv.xlsx' # 현재 폴더 위치의 해당 파일명의 .xls 파일 open
unit = np.array(["length", "area", "volume"])
for i, n in enumerate(unit):
globals()['df_{}'.format(n)] = pd.read_excel(openfiledir + filename, sheet_name = n) # 각 sheet name 으로 dataframe 만들기
globals()['Indname_{}'.format(n)] = globals()['df_{}'.format(n)][format(n)] # Dataframe 별 index 지정
globals()['df_{}'.format(n)].index = globals()['Indname_{}'.format(n)] # Dataframe 에 index 설정
globals()['df_{}'.format(n)].drop(format(n), axis = 1, inplace = True) # Dataframe 첫 열 삭제
# for 문으로 저장하는건??
# df_length = pd.read_excel(openfiledir + filename, sheet_name = "length")
# Indname_length = df_length["length"]
# df_length.index = Indname_length
# df_length.drop('length', axis =1, inplace = True)
with open('Unitconv_length.p','wb') as file:
pickle.dump(df_length, file)
with open('Unitconv_area.p','wb') as file:
pickle.dump(df_area, file)
with open('Unitconv_volume.p','wb') as file:
pickle.dump(df_volume, file)
air prop
# -*- coding: utf-8 -*-
"""
Created on Thu Jan 19 15:39:48 2023
@author: seungj.jung
"""
#### Excel Data base 만들기
import os
import pandas as pd
# from pandas import Series
import pickle
# excel = Dispatch('excel.Application') # win32com.client로 excel call
openfiledir = os.getcwd() + '\\' # 현재 폴더 위치
filename = 'Air_properties.xlsx' # 현재 폴더 위치의 해당 파일명의 .xls 파일 open
df = pd.read_excel(openfiledir + filename)
IndName = df['Temperature']
IndName[0] = "(Units)"
df.index = IndName # Index 지정
df.drop([1], inplace = True)
df.drop(['Unnamed: 0','Temperature'], axis = 1, inplace = True)
df.drop(df.index[1], inplace = True)
ColName = df.columns # Column 지정
with open('Air_prop.p','wb') as file:
pickle.dump(df, file)
Table_Export.py