You want to extract values from a data frame based on specific conditions.
loc = pd.read_csv("./inference/output/temp.txt", sep=" ", header=None)
loc = loc.drop([5], axis=1)
loc.columns = ["classID", "x", "y", "width", "height"]
loc["x_lo"] = round(loc["x"] * 1080) #V50 medium resolution
loc["y_lo"] = round(loc["y"] * 2340)
display(loc)
x_loc = loc.x_lo[loc["classID"] == "42"]
y_loc = loc.y_lo[loc["classID"] == "42"]
How can I extract the value of another row based on the classID?
python pandas dataframe
Try loc.info()
. I think classID is not string type but int type.
© 2024 OneMinuteCode. All rights reserved.