2021
07-09
07-09
Python 如何让特征值滞后一行
看代码吧~#加载库importpandasaspd#데이터프레임을만듭니다.dataframe=pd.DataFrame()#模拟数据dataframe["dates"]=pd.date_range("1/1/2001",periods=5,freq="D")dataframe["stock_price"]=[1.1,2.2,3.3,4.4,5.5]dataframe.head()#让值滞后一行dataframe["previous_days_stock_price"]=dataframe["stock_price"].shif...
继续阅读 >