import pandas as pd
import os
from common.common_tool import make_dir_if_not_exists
from conf.path_config import data_dir
pd.set_option('display.max_columns', 1000000)
pd.set_option('display.max_rows', 1000000)
pd.set_option('display.max_colwidth', 1000000)
pd.set_option('display.width', 1000000)
def get_data_dict(path1):
df_t1 = pd.read_excel(path1, sheet_name=None, header=1)
aa = ['23.1.1', '23.1.2', '23.1.3', '23.1.4', '23.1.5', '23.1.6', '23.1.7', '23.1.8', '23.1.9', '23.1.10', '23.1.11', '23.1.12', '23.1.13', '23.1.14', '23.1.15', '23.1.16', '23.1.17', '23.1.18', '23.1.19', '23.1.20', '23.1.21', '23.1.22', '23.1.23', '23.1.24', '23.1.25', '23.1.26', '23.1.27', '23.1.28', '23.1.29', '23.1.30', '23.1.31', '23.2.1', '23.2.2', '23.2.3', '23.2.4', '23.2.5', '23.2.6', '23.2.7', '23.2.8', '23.2.9', '23.2.10', '23.2.11', '23.2.12', '23.2.13', '23.2.14', '23.2.15', '23.2.16', '23.2.17', '23.2.18', '23.2.19', '23.2.20', '23.2.21', '23.2.22', '23.2.23', '23.2.24', '23.2.25', '23.2.26', '23.2.27', '23.2.28', '23.3.1', '23.3.2', '23.3.3', '23.3.4', '23.3.5', '23.3.6', '23.3.7', '23.3.8', '23.3.9', '23.3.10', '23.3.11', '23.3.12', '23.3.13', '23.3.14', '23.3.15', '23.3.16', '23.3.17', '23.3.18', '23.3.19', '23.3.20', '23.3.21', '23.3.22', '23.3.23', '23.3.24', '23.3.25', '23.3.26', '23.3.27', '23.3.28', '23.3.29', '23.3.30', '23.3.31', '23.4.1', '23.4.2', '23.4.3', '23.4.4', '23.4.5', '23.4.6', '23.4.7', '23.4.8', '23.4.9', '23.4.10', '23.4.11', '23.4.12', '23.4.13', '23.4.14', '23.4.15', '23.4.16', '23.4.17', '23.4.18', '23.4.19', '23.4.20', '23.4.21', '23.4.22', '23.4.23', '23.4.24', '23.4.25', '23.4.26', '23.4.27', '23.4.28', '23.4.29', '23.4.30', '23.5.1', '23.5.2', '23.5.3', '23.5.4', '23.5.5', '23.5.6', '23.5.7', '23.5.8', '23.5.9', '23.5.10', '23.5.11', '23.5.12', '23.5.13', '23.5.14', '23.5.15', '23.5.16', '23.5.17', '23.5.18', '23.5.19', '23.5.20', '23.5.21', '23.5.22', '23.5.23', '23.5.24', '23.5.25', '23.5.26', '23.5.27', '23.5.28', '23.5.29', '23.5.30', '23.5.31', '23.6.1', '23.6.2', '23.6.3', '23.6.4', '23.6.5', '23.6.6', '23.6.7', '23.6.8']
for i, b in df_t1.items():
if i in aa:
os.makedirs(os.path.join(data_dir, '2023', i), exist_ok=True)
b.to_excel(os.path.join(data_dir, '2023', i, i + ".xlsx"), index=False)
if __name__ == '__main__':
get_data_dict("每日批复明细2023.xlsx")
import pandas as pd
import os
from common.common_tool import make_dir_if_not_exists
from conf.path_config import data_dir
pd.set_option('display.max_columns', 1000000)
pd.set_option('display.max_rows', 1000000)
pd.set_option('display.max_colwidth', 1000000)
pd.set_option('display.width', 1000000)
def get_data_dict(path):
all_dir_name = os.listdir(path)
all_dir_name.sort(key=lambda x: os.path.getctime(os.path.join(path, x)))
a = []
b = []
c = []
for dir_name in all_dir_name:
df = pd.read_excel(os.path.join(path, dir_name, dir_name + '.xlsx'), index_col=0)
a.append(dir_name)
b.append(df.loc[df.index == '今日需求量', '总计'].values[0])
c.append(df.loc[df.index == '昨日用气量', '总计'].values[0])
df1 = pd.DataFrame({'日期': a, '今日需求量': b, '昨日用气量': c})
df1.to_csv('2023每日批复明细.csv', index=False)
if __name__ == '__main__':
get_data_dict(os.path.join(data_dir, '2023'))```