def get_max_mode_candidate(path_to_dataset, value_field): mode_dict = {} with arcpy.da.SearchCursor(path_to_dataset, [value_field]) as get_mode: for record in get_mode: val = record[0] if val in mode_dict: freq = mode_dict[val] freq += 1 mode_dict[val] = freq del freq else: mode_dict[val] = 1 max_count = 0 mode_candidates = [] for val in mode_dict: if mode_dict[val] > max_count: mode_candidates = [val] elif mode_dict[val] == max_count: mode_candidates.append(val) else: pass max_mode = max(mode_candidates) return max_mode
Hi.I have this problem.In a Spatial Join the merge rules allow you to specify how values from two or more input numeric fields are merged into a single output value.In a feature class (FC) I have 4 point features that have this value for the field "Alert_Contaminant":ID Alert_Level_Contaminant1 22 23 34 3If I do a Spatial Join between this FC (join fetures) and a Grid (target), I have to choose for the join features fields, "Alert_Level_Contaminant", the Merge Rule.I choose the "mode" merge rule because I want the most frequent value. But when two value have the same frequency what value for default the overlay tool choose ?I want to that between the two values �??�??with the same frequency is chosen the one with the highest value. Is it possible ?Maybe with Python ?Someone could you help me ?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.