Spaces:
Sleeping
Sleeping
improved find column function
Browse files- process.py +5 -1
process.py
CHANGED
|
@@ -109,6 +109,10 @@ def find_name_column(df):
|
|
| 109 |
|
| 110 |
|
| 111 |
def find_date_column(df):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
date_pattern = r"\b\d{2,4}[-/]\d{1,2}[-/]\d{2,4}\b" # Regex pattern for common date formats
|
| 113 |
|
| 114 |
max_count = 0
|
|
@@ -124,4 +128,4 @@ def find_date_column(df):
|
|
| 124 |
max_count = valid_count
|
| 125 |
date_column = column
|
| 126 |
|
| 127 |
-
return date_column
|
|
|
|
| 109 |
|
| 110 |
|
| 111 |
def find_date_column(df):
|
| 112 |
+
# Check if 'Treatment dates' column exists
|
| 113 |
+
if 'Treatment dates' in df.columns:
|
| 114 |
+
return 'Treatment dates'
|
| 115 |
+
|
| 116 |
date_pattern = r"\b\d{2,4}[-/]\d{1,2}[-/]\d{2,4}\b" # Regex pattern for common date formats
|
| 117 |
|
| 118 |
max_count = 0
|
|
|
|
| 128 |
max_count = valid_count
|
| 129 |
date_column = column
|
| 130 |
|
| 131 |
+
return date_column
|