jueqingsizhe66 / jueqingsizhe66.github.io

my hugo blogs
0 stars 0 forks source link

post/python-pandas%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E8%BD%AC%E5%8C%96/ #7

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

python pandas数据结构转化 | Macro Life

背景介绍 windsim已经导出所有机位点的风速风向,每个机组都有16个扇区的风速和风向信息(轮毂高度处) 同时你还有fluent或者AIWIN

https://jueqingsizhe66.github.io/post/python-pandas%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84%E8%BD%AC%E5%8C%96/

jueqingsizhe66 commented 4 years ago
def getPower(nac,i,powerlaw=powerlaw):
    calPower=np.zeros(len(nac),dtype=float)
    calVel=np.zeros(len(nac),dtype=float)
    cpVs = powerlaw.iloc[:, 0]
    cpPs = powerlaw.iloc[:, 1]
    count=0
    for vel in nac:
        # calPower[count]=getMean(cpVs,cpPs,modify(vel))
        calPower[count]=getMean(cpVs,cpPs,vel)
        calVel[count]=vel
        count=count+1

    calPowerSeries=pd.DataFrame([calVel,calPower]).T
    calPowerSeries.to_csv(str(i)+"-power.csv")
    return np.sum(calPower)/6000

#DateFrame .T转置的运用--行列转换