[英]If one dataframe value exists in another dataframe, then get a value from the dataframe
[英]Get approx value from dataframe
我想獲得表中不存在的給定“LapTimeSeconds”的“距離”值,有什么辦法嗎?
也許使用插值? 但是怎么辦? 提前致謝
# Something like this?
driver1_tel.loc[(driver1_tel["LapTimeSeconds"] == (3.0)]
您可以在感興趣的列上使用 scipy 的插值 function。 通過查看您所寫的內容,它會 go 類似於:
from scipy import interpolate
x = df.LaptimeSecond
y = df.Distance
f = interpolate.interp1d(x, y)
ynew = f(3)
變量 ynew 將為您提供 3 秒單圈時間的插值距離。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.