<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Creating a new tool in ArcGIS 10.8 in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359994#M69398</link>
    <description>&lt;P&gt;Thank you. I tried but I faced some challenges, may be due to lack of experience.&lt;/P&gt;</description>
    <pubDate>Tue, 12 Dec 2023 21:50:53 GMT</pubDate>
    <dc:creator>AbdAllaAdlan</dc:creator>
    <dc:date>2023-12-12T21:50:53Z</dc:date>
    <item>
      <title>Creating a new tool in ArcGIS 10.8</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359099#M69371</link>
      <description>&lt;P&gt;Hi everyone ..&lt;/P&gt;&lt;P&gt;I wrote a python code to sort an excel file containing parcel numbers and their areas, and the output is an excel file containing ranges of parcel numbers with same area in one record instead of each number in a record. I'm new to scripting in ArcGIS, I need someone to convert this code to a script tool in ArcGIS and to and to modify the code so that the input file is a Feature class table instead of an excel file but the output files remains as excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import pandas as pd&lt;/P&gt;&lt;P&gt;# Read the Excel file&lt;BR /&gt;input_file = 'original.xlsx' # Replace 'input.xlsx' with your Excel file name&lt;BR /&gt;output_file = 'test1.xlsx' # Replace 'output.xlsx' with your desired output file name&lt;/P&gt;&lt;P&gt;# Read the Excel file into a Pandas DataFrame&lt;BR /&gt;df = pd.read_excel(input_file)&lt;/P&gt;&lt;P&gt;# Sort the data by area and then by parcel number&lt;BR /&gt;# df = df.sort_values(by=['Area', 'Parcel Number'])&lt;/P&gt;&lt;P&gt;# Initialize variables to store output data&lt;BR /&gt;output_data = {'Parcel Range': [], 'Area': []}&lt;BR /&gt;current_area = None&lt;BR /&gt;current_range_start = None&lt;BR /&gt;previous_parcel = None&lt;/P&gt;&lt;P&gt;# Iterate through the data to create records as per the requirements&lt;BR /&gt;for index, row in df.iterrows():&lt;BR /&gt;parcel_num = row['Parcel Number']&lt;BR /&gt;area = row['Area']&lt;BR /&gt;&lt;BR /&gt;if current_area != area or previous_parcel is None or parcel_num != previous_parcel + 1:&lt;BR /&gt;if current_area is not None:&lt;BR /&gt;if current_range_start == previous_parcel:&lt;BR /&gt;output_data['Parcel Range'].append(f"{current_range_start}")&lt;BR /&gt;else:&lt;BR /&gt;output_data['Parcel Range'].append(f"{current_range_start} - {previous_parcel}")&lt;BR /&gt;output_data['Area'].append(current_area)&lt;BR /&gt;&lt;BR /&gt;current_area = area&lt;BR /&gt;current_range_start = parcel_num&lt;BR /&gt;&lt;BR /&gt;previous_parcel = parcel_num&lt;/P&gt;&lt;P&gt;# Add the last range and area to the output&lt;BR /&gt;if current_area is not None:&lt;BR /&gt;output_data['Parcel Range'].append(f"{current_range_start} - {previous_parcel}")&lt;BR /&gt;output_data['Area'].append(current_area)&lt;/P&gt;&lt;P&gt;# Create a DataFrame from the output data&lt;BR /&gt;output_df = pd.DataFrame(output_data)&lt;/P&gt;&lt;P&gt;# Save the transformed data to a new Excel file&lt;BR /&gt;output_df.to_excel(output_file, index=False)&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 15:12:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359099#M69371</guid>
      <dc:creator>AbdAllaAdlan</dc:creator>
      <dc:date>2023-12-11T15:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new tool in ArcGIS 10.8</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359151#M69372</link>
      <description>&lt;P&gt;Setting up scripts as a tool is fairly simple. I would suggest reading the documentation here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://desktop.arcgis.com/en/arcmap/latest/analyze/creating-tools/a-quick-tour-of-creating-script-tools.htm" target="_blank"&gt;What is a script tool?—ArcMap | Documentation (arcgis.com)&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Dec 2023 16:13:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359151#M69372</guid>
      <dc:creator>ClayDonaldsonSWCA</dc:creator>
      <dc:date>2023-12-11T16:13:01Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a new tool in ArcGIS 10.8</title>
      <link>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359994#M69398</link>
      <description>&lt;P&gt;Thank you. I tried but I faced some challenges, may be due to lack of experience.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Dec 2023 21:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/creating-a-new-tool-in-arcgis-10-8/m-p/1359994#M69398</guid>
      <dc:creator>AbdAllaAdlan</dc:creator>
      <dc:date>2023-12-12T21:50:53Z</dc:date>
    </item>
  </channel>
</rss>

