Spaces:
Sleeping
Sleeping
Update Code_2_7.py
Browse files- Code_2_7.py +6 -8
Code_2_7.py
CHANGED
|
@@ -1569,21 +1569,19 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
|
|
| 1569 |
|
| 1570 |
|
| 1571 |
grouped_df = SimilarAreaDictionary.groupby('Color').agg({
|
|
|
|
| 1572 |
'Occurences': 'sum', # Sum of occurrences for each color
|
| 1573 |
'Area':'first',
|
| 1574 |
'Total Area': 'sum', # Sum of areas for each color
|
| 1575 |
'Perimeter':'first',
|
| 1576 |
'Total Perimeter': 'sum', # Sum of perimeters for each color
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1577 |
|
| 1578 |
}).reset_index()
|
| 1579 |
|
| 1580 |
-
|
| 1581 |
-
# Apply the unification function
|
| 1582 |
-
# SimilarAreaDictionary = unify_colors(SimilarAreaDictionary)
|
| 1583 |
-
|
| 1584 |
-
|
| 1585 |
-
# print(SimilarAreaDictionary)
|
| 1586 |
-
# print(grouped_df)
|
| 1587 |
# doc.save(OutputPdfStage1)
|
| 1588 |
# OutputPdfStage2=adjustannotations(OutputPdfStage1,text_with_positions)
|
| 1589 |
modified_pdf_data = doc.tobytes()
|
|
@@ -1619,4 +1617,4 @@ def mainFunctionDrawImgPdf(datadoc,dxfpath, dxfratio,SearchArray,pdfpath=0,pdfna
|
|
| 1619 |
print('LISTTT',list1)
|
| 1620 |
return doc2,latestimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas
|
| 1621 |
|
| 1622 |
-
|
|
|
|
| 1569 |
|
| 1570 |
|
| 1571 |
grouped_df = SimilarAreaDictionary.groupby('Color').agg({
|
| 1572 |
+
'Guess': 'first',
|
| 1573 |
'Occurences': 'sum', # Sum of occurrences for each color
|
| 1574 |
'Area':'first',
|
| 1575 |
'Total Area': 'sum', # Sum of areas for each color
|
| 1576 |
'Perimeter':'first',
|
| 1577 |
'Total Perimeter': 'sum', # Sum of perimeters for each color
|
| 1578 |
+
'Length':'first',
|
| 1579 |
+
'Total Length': 'sum', # Sum of lengths for each color
|
| 1580 |
+
'Texts': 'first', # Keep the first occurrence of 'Texts'
|
| 1581 |
+
'Comments': 'first' # Keep the first occurrence of 'Comments'
|
| 1582 |
|
| 1583 |
}).reset_index()
|
| 1584 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1585 |
# doc.save(OutputPdfStage1)
|
| 1586 |
# OutputPdfStage2=adjustannotations(OutputPdfStage1,text_with_positions)
|
| 1587 |
modified_pdf_data = doc.tobytes()
|
|
|
|
| 1617 |
print('LISTTT',list1)
|
| 1618 |
return doc2,latestimg, SimilarAreaDictionary ,spreadsheetId, spreadsheet_url , namepathArr , list1,hatched_areas
|
| 1619 |
|
| 1620 |
+
|