[英]Determine a value based on the difference between another column of this row and the previous row
[英]Modify values in 1 column based on the value in another column in the previous row
移位功能有效。 要將Min_val保留在第一列中,您只需使用loc
函數指定1:
否則它將第一行設置為NaN
df_ticker.loc[1:,'Min_val'] = df_ticker['Max_val'].shift(1) + 1
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.