removed part count because it caused a lot of problems
Browse files- functions.py +6 -5
functions.py
CHANGED
@@ -21,15 +21,16 @@ df = df[df['s3_available'] == True]
|
|
21 |
|
22 |
def get_car_parts_count():
|
23 |
car_parts = df.columns[6:]
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
27 |
|
28 |
def get_random_image(parts_filter=False):
|
29 |
not_validated_imgs = df[df["validated"] == False]["img_name"].tolist()
|
30 |
if parts_filter:
|
31 |
-
# remove the count from the part name
|
32 |
-
parts_filter = [part.split(" (")[0] for part in parts_filter]
|
33 |
# get rows where all selected parts are damaged (> 0)
|
34 |
filtered_imgs = df[(df[parts_filter] > 0).all(axis=1)]["img_name"].tolist()
|
35 |
not_validated_imgs = list(set(not_validated_imgs) & set(filtered_imgs))
|
|
|
21 |
|
22 |
def get_car_parts_count():
|
23 |
car_parts = df.columns[6:]
|
24 |
+
return car_parts
|
25 |
+
# # create a dictionary with the count of each part, +1 for a part if value > 0
|
26 |
+
# car_parts_count = {part: len(df[df[part] > 0]) for part in car_parts}
|
27 |
+
# return [f"{part} ({count})" for part, count in car_parts_count.items()]
|
28 |
|
29 |
def get_random_image(parts_filter=False):
|
30 |
not_validated_imgs = df[df["validated"] == False]["img_name"].tolist()
|
31 |
if parts_filter:
|
32 |
+
# # remove the count from the part name
|
33 |
+
# parts_filter = [part.split(" (")[0] for part in parts_filter]
|
34 |
# get rows where all selected parts are damaged (> 0)
|
35 |
filtered_imgs = df[(df[parts_filter] > 0).all(axis=1)]["img_name"].tolist()
|
36 |
not_validated_imgs = list(set(not_validated_imgs) & set(filtered_imgs))
|