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.
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
549 PHP ssh2_scp_send fails to send files as intended
709 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.