我正在从具有多个行和列的csv文件中的特定列(左,上,长度和宽度)中提取所有整数值。我曾经用熊猫来隔离我感兴趣的列,但是我坚持如何使用数组的特定部分。
让我解释一下:我需要使用CSV文件的具有“ left,top,length和width”属性的列,然后才能获得xmin,ymin,xmax和ymax(它们在图像中由框协调)。此列中的行示例如下所示:
[{"left":171,"top":0,"width":163,"height":137,"label":"styrofoam container"},{"left":222,"top":42,"width":45,"height":70,"label":"chopstick"}]
我需要提取171、0、163和137来进行必要的操作以找到我的xmax,xmin,ymax和ymin
上一行是我的pandas数组中的一行,如何提取运行操作所需的数字?
这是我编写的用于提取列的代码,这是我到目前为止的内容:
importosimportcsvimportpandasimportnumpyasnp
csvPath="/path/of/my/csvfile/csvfile.csv"data=pandas.read_csv(csvPath)csv_coords=data['Answer.annotation_data'].values#column with the coordinatesimage_name=data['Input.image_url'].valuesp