You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
794 B
Python
18 lines
794 B
Python
import numpy as np
|
|
import pandas as pd
|
|
n1 = np.array([[1,1,1]])
|
|
n2 = np.array([1,1,1]).reshape(1,-1)
|
|
print(n2)
|
|
n2 = np.array([]).reshape(3,-1)
|
|
|
|
print(np.max([[1,2,3],[4,5,6]]))
|
|
|
|
file_dir = r'C:\Users\鸽子\Desktop\浙江各地市分电压日电量数据'
|
|
df = pd.read_csv(r'C:\Users\鸽子\Desktop\浙江省各地市日电量数据21-23年 .csv',encoding='gbk')
|
|
df.columns = df.columns.map(lambda x:x.strip())
|
|
for city in df['地市'].drop_duplicates():
|
|
df_city = df[df['地市']== city]
|
|
df_city['stat_date'] = pd.to_datetime(df_city['stat_date'],format='%Y/%m/%d')
|
|
df_city = df_city[df_city.columns[:-1]]
|
|
df_city['stat_date'] = df_city['stat_date'].astype('str')
|
|
df_city.to_excel(fr'C:\Users\鸽子\Desktop\浙江各地市分电压日电量数据\{city}.xlsx',index=False) |