来自“补全excel中缺失的行”
import numpy as np
import pandas as pd
import matplotlib as mpl
import datetime
path = r"D:\BCf\Dry\era5\coef_24days_gaussfit.xlsx"
data = pd.read_excel(path,sheet_name = "2019_12_blh",parse_dates=[1],index_col = 1,header=0)
t_index = pd.date_range("2019-12-7 8:00","2020-01-01 7:00",freq="0.5H")
data = data.reindex(t_index)
pd.DataFrame(data["blh(m)"].interpolate(method = "linear",limit_direction = "both")).to_csv(r"D:\BCf\Dry\era5\blh_interpolate.csv")
网友评论