I have a time series dataframe where I need to create a boolean-valued column, which is
As you have not provided any sample data, so I am not 100% sure, what you exactly want. But here is what I think you need to do
df=pd.DataFrame([np.random.randn(10,1)],columns=['first'])
df['prev']=df.shift(1)
df['prev']-df['first']>df['first']*0.1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.