我必须把一个数据帧插入另一个数据帧 这是我的第一个数据帧:
x=donne['Time Series (Daily)']
df1 = pd.DataFrame(x)
df1 = df1.rename(index={'2. high':'Hight','3. low':'Low'})
df1.loc['Hight']=df1.loc['Hight'].astype(float)
df1.loc['Low']=df1.loc['Low'].astype(float)
df1.loc['H+L']=(df1.loc['Hight'] + df1.loc['Low'])/2
df1.loc['sma']=0
df1
我想把这个数据框插进去
`frame=[date,sma]`
concat=pd.concat(frame,axis=0,ignore_index=True)
concat
我想将concat从列=2018-11-23插入df1 我使用concat、insert和append,但结果总是错误的
问题是对齐,两者都需要
DatetimeIndex
首先建议通过^{}
DataFrame
转置索引中的DatetimeIndex
:然后用转置和
DatetimeIndex
更改sma
数据帧:上次将^{} 与
axis=1
一起使用,因为新列:或分配:
样本:
如果确实需要列中的
DatetimeIndex
:相关问题 更多 >
编程相关推荐