{"id":1276772,"date":"2021-07-26T11:03:17","date_gmt":"2021-07-26T18:03:17","guid":{"rendered":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=1276772"},"modified":"2026-01-07T12:20:55","modified_gmt":"2026-01-07T20:20:55","slug":"create-your-first-script-in-insights","status":"publish","type":"blog","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights","title":{"rendered":"Create your first script in the Insights scripting environment"},"author":6771,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":""},"categories":[23341],"tags":[101302,25071,100192,24341,24351],"industry":[],"product":[36801],"class_list":["post-1276772","blog","type-blog","status-publish","format-standard","hentry","category-analytics","tag-get-started","tag-learn-arcgis","tag-learn-by-doing","tag-python","tag-scripting","product-insights"],"acf":{"short_description":"Use the Insights scripting environment to perform a data engineering workflow. ","flexible_content":[{"acf_fc_layout":"sidebar","content":"<p>ArcGIS Insights is retiring. For more information on the retirement of\u00a0<span class=\"ph\">ArcGIS Insights<\/span> and migration recommendations, see the <a class=\"xref xref\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/announcements\/deprecation-notice-for-arcgis-insights\/\" target=\"_blank\" rel=\"noopener\">deprecation notice<\/a>.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<p><em>The Insights scripting environment can be used to access Python and R kernels through a Jupyter Kernel Gateway. This lesson will walk you through the fundamentals of using the scripting environment to complete a data engineering workflow.<\/em><\/p>\n<p>The number of fatal cycling accidents in Ottawa, Canada, has been troubling cycling advocates for years. In the <a href=\"https:\/\/learn.arcgis.com\/en\/projects\/get-started-with-arcgis-insights\/\">Get started with ArcGIS Insights<\/a> lesson on Learn ArcGIS, you used Insights to analyze cycling accidents in Ottawa from 2015 to 2018.<\/p>\n<p>The 2019 traffic collision data is now available on the Open Ottawa website. You will use the Insights scripting environment to update the dataset from the lesson with the 2019 data, and then rerun the analysis.<\/p>\n<p><em>This workflow was last tested on July 24, 2023.<\/em><\/p>\n"},{"acf_fc_layout":"sidebar","content":"<p><strong>Note<\/strong>:<\/p>\n<p>It is not necessary to complete the <strong>Get started<\/strong> lesson before following this workflow.<\/p>\n","image_reference":false,"layout":"standard","image_reference_figure":"","snippet":"","spotlight_name":"","section_title":"","position":"Center","spotlight_image":false},{"acf_fc_layout":"content","content":"<h1>Before you begin<\/h1>\n<p>Insights in ArcGIS Enterprise and Insights desktop support connections to a Jupyter Kernel Gateway, which can be used to open a scripting environment and run scripts in Python and R. If you have access to Insights in ArcGIS Online, you can <a href=\"https:\/\/www.esri.com\/en-us\/arcgis\/products\/arcgis-insights\/resources\/desktop-client-download\">download Insights desktop<\/a> and use it to access the Insights scripting environment. You can use your Insights in ArcGIS Online account to activate Insights desktop. Insights 2021.2 or later is recommended for this workflow.<\/p>\n<p>You must also set up a Jupyter Kernel Gateway. Steps to set up a Jupyter Kernel Gateway can be found in the <a href=\"https:\/\/github.com\/Esri\/insights-scripting-guide\">Insights Scripting Guide<\/a> on GitHub. Additional information on scripting in Insights can be found in the <a href=\"https:\/\/doc.arcgis.com\/en\/insights\/latest\/analyze\/scripting-overview.htm\">help documentation<\/a>.<\/p>\n<h1>Import a workbook package<\/h1>\n<p>You will start by importing a workbook package into ArcGIS Insights. If you already completed the <strong>Get started with ArcGIS Insights <\/strong>lesson, you can reopen your workbook and skip to the next section.<\/p>\n<ol>\n<li>Download the <a href=\"https:\/\/www.arcgis.com\/sharing\/rest\/content\/items\/1b61ec685c2a476a98c8c4d80140b974\/data\">Ottawa_cycling_accidents.insightswbk<\/a> file. The item is an Insights workbook package containing all the data and analysis from the Get started lesson.<\/li>\n<li>Locate the downloaded file on your computer. Most browsers download to your computer&#8217;s Downloads folder by default.<\/li>\n<li>Open Insights in ArcGIS Enterprise or launch Insights desktop.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">If you are opening Insights desktop for the first time, you will be asked to <a href=\"https:\/\/doc.arcgis.com\/en\/insights\/latest\/get-started\/activate-desktop.htm\">activate your account<\/a>. You can activate Insights desktop using an Insights in ArcGIS Enterprise account or Insights in ArcGIS Online account.<\/p>\n<p style=\"padding-left: 80px;\">If this is your first time signing in to your Insights account, the <strong>Welcome to Insights<\/strong> window appears.<\/p>\n<ol start=\"4\">\n<li>If necessary, in the <strong>Welcome to Insights<\/strong> window, click <strong>Skip<\/strong>.<\/li>\n<li>Click the <strong>Workbooks\u00a0<\/strong>tab.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":826831,"id":826831,"title":"1_WorkbooksTab","filename":"1_WorkbooksTab.jpg","filesize":6622,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/use-chime-arcgis-insights\/1_workbookstab","alt":"The Workbooks tab on the Insights home page","author":"6771","description":"","caption":"","name":"1_workbookstab","status":"inherit","uploaded_to":826531,"date":"2020-04-20 17:32:42","modified":"2020-04-20 17:33:09","menu_order":0,"mime_type":"image\/jpeg","type":"image","subtype":"jpeg","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":241,"height":331,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab-213x200.jpg","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","medium-width":190,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","medium_large-width":241,"medium_large-height":331,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","large-width":241,"large-height":331,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","1536x1536-width":241,"1536x1536-height":331,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","2048x2048-width":241,"2048x2048-height":331,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","card_image-width":241,"card_image-height":331,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/1_WorkbooksTab.jpg","wide_image-width":241,"wide_image-height":331}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"6\">\n<li>Click <strong>Import<\/strong> and open the Ottawa_cycling_accidents.insightswbk file that you unzipped in step 2.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The workbook is loaded onto your <strong>Workbook<\/strong> page.<\/p>\n<ol start=\"7\">\n<li>Click the <strong>Ottawa cycling accidents<\/strong> workbook to open it. It may take a few minutes for the imported workbook to load the first time it is opened.<\/li>\n<\/ol>\n<h1>Add data and connect to your Jupyter Kernel Gateway<\/h1>\n<p>The 2019 traffic collision data is available to download from the Open Ottawa website. In this section, you will download the dataset, add it to your Insights workbook, and connect to your Jupyter Kernel Gateway.<\/p>\n<ol>\n<li>Follow the link to the <a href=\"https:\/\/open.ottawa.ca\/datasets\/ottawa::traffic-collision-by-location-2019\/about\">Traffic Collision by Location 2019<\/a> dataset on Open Ottawa.<\/li>\n<li>Click the <strong>Download<\/strong> button. Under <strong>CSV<\/strong>, click <strong>Download<\/strong>.<\/li>\n<li>Return to Insights and click the <strong>Add to page<\/strong> button.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287352,"id":1287352,"title":"2_AddData","filename":"2_AddData.png","filesize":4988,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/2_adddata","alt":"The Add to page button","author":"6771","description":"","caption":"","name":"2_adddata","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:02:30","modified":"2021-07-08 11:02:52","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":465,"height":108,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData-213x108.png","thumbnail-width":213,"thumbnail-height":108,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","medium-width":464,"medium-height":108,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","medium_large-width":465,"medium_large-height":108,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","large-width":465,"large-height":108,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","1536x1536-width":465,"1536x1536-height":108,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","2048x2048-width":465,"2048x2048-height":108,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","card_image-width":465,"card_image-height":108,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/2_AddData.png","wide_image-width":465,"wide_image-height":108}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"4\">\n<li>Click the <strong>Upload file<\/strong> tab.<\/li>\n<li>Browse to the spreadsheet you downloaded and open it.<\/li>\n<li>Click <strong>Add<\/strong>.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The dataset is added to the data pane. Next, you will open the Insights scripting environment and connect to your Jupyter Kernel Gateway.<\/p>\n<ol start=\"7\">\n<li>Click the <strong>Scripting<\/strong> button to open the scripting environment.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287362,"id":1287362,"title":"3_OpenScriptingEnvironment","filename":"3_OpenScriptingEnvironment.png","filesize":722,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/3_openscriptingenvironment","alt":"Open the Insights scripting environment","author":"6771","description":"","caption":"","name":"3_openscriptingenvironment","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:03:47","modified":"2021-07-08 11:04:01","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":275,"height":47,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment-213x47.png","thumbnail-width":213,"thumbnail-height":47,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","medium-width":275,"medium-height":47,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","medium_large-width":275,"medium_large-height":47,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","large-width":275,"large-height":47,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","1536x1536-width":275,"1536x1536-height":47,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","2048x2048-width":275,"2048x2048-height":47,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","card_image-width":275,"card_image-height":47,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/3_OpenScriptingEnvironment.png","wide_image-width":275,"wide_image-height":47}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"8\">\n<li>In the <strong>Kernel Gateway connection<\/strong> window, select your Kernel Gateway connection. If you have not already created a connection, click the <strong>Add new<\/strong> tab and enter the URL for your Jupyter Kernel Gateway. The web socket will be updated automatically using your URL.<\/li>\n<li>Click <strong>Connect<\/strong>.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The scripting environment opens. The script was written using Python, so you will select the Python kernel.<\/p>\n<ol start=\"10\">\n<li>Click <strong>Select Kernel<\/strong> and choose <strong>Python 3<\/strong> from the menu.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287372,"id":1287372,"title":"4_PythonKernel","filename":"4_PythonKernel.png","filesize":1732,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/4_pythonkernel-2","alt":"Select the Python kernel","author":"6771","description":"","caption":"","name":"4_pythonkernel-2","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:04:48","modified":"2021-07-08 11:05:00","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":179,"height":125,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","thumbnail-width":179,"thumbnail-height":125,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","medium-width":179,"medium-height":125,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","medium_large-width":179,"medium_large-height":125,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","large-width":179,"large-height":125,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","1536x1536-width":179,"1536x1536-height":125,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","2048x2048-width":179,"2048x2048-height":125,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","card_image-width":179,"card_image-height":125,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/4_PythonKernel.png","wide_image-width":179,"wide_image-height":125}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p>The scripting environment is now ready to start creating and running scripts.<\/p>\n<h1>Run Python code in the scripting environment<\/h1>\n<p>In this step, you will write and run code to append the 2019 traffic collision data to the Collisions dataset. You will be working with Pandas DataFrames, so you will start by importing Pandas.<\/p>\n<ol>\n<li>Click the first In[ ] cell and enter the code <code>import pandas as pd<\/code>. Click the <strong>Run<\/strong> button or press Shift+Enter to run the cell.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The code in the cell runs. A new In[ ] cell is added to the scripting environment. Next you will create a DataFrame for the Collisions dataset.<\/p>\n<ol start=\"2\">\n<li>In the next In[ ] cell, enter the code <code>df1=pd.DataFrame()<\/code>, but do not run the cell.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">You will select fields from the <strong>Collisions<\/strong> dataset to use in the DataFrame.<\/p>\n<ol start=\"3\">\n<li>Expand the <strong>Collisions<\/strong> dataset in the data pane. Select the following fields: Year, TOTAL_COLL, Number of cyclists, PEDESTRIAN, X, and Y.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287382,"id":1287382,"title":"5_SelectFields","filename":"5_SelectFields.png","filesize":8721,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/5_selectfields","alt":"Select fields in the data pane","author":"6771","description":"","caption":"","name":"5_selectfields","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:05:56","modified":"2021-07-08 11:06:09","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":301,"height":425,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","medium-width":185,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","medium_large-width":301,"medium_large-height":425,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","large-width":301,"large-height":425,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","1536x1536-width":301,"1536x1536-height":425,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","2048x2048-width":301,"2048x2048-height":425,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","card_image-width":301,"card_image-height":425,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/5_SelectFields.png","wide_image-width":301,"wide_image-height":425}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"4\">\n<li>Drag the selected fields to the scripting environment inside the brackets in the second cell.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287402,"id":1287402,"title":"6_DragFields","filename":"6_DragFields.png","filesize":30994,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/6_dragfields","alt":"Drag fields to the scripting console","author":"6771","description":"","caption":"","name":"6_dragfields","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:07:41","modified":"2021-07-08 11:08:02","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":700,"height":301,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","medium-width":464,"medium-height":200,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","medium_large-width":700,"medium_large-height":301,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","large-width":700,"large-height":301,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","1536x1536-width":700,"1536x1536-height":301,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","2048x2048-width":700,"2048x2048-height":301,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","card_image-width":700,"card_image-height":301,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/6_DragFields.png","wide_image-width":700,"wide_image-height":301}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"5\">\n<li>Run the cell.<\/li>\n<li>In the next cell, create a DataFrame for the Traffic_Collision_by_Location_2019 dataset using the code <code>df2=pd.DataFrame()<\/code> and the following fields: Total_Collisions, Cyclists_Collisions, Pedestrian_collisions, X, and Y. Run the cell.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">You now have two DataFrames, one for each collision dataset. However, the 2019 data is missing a Year field. You will add a Year field to df2 in the first position so that it matches df1.<\/p>\n<ol start=\"7\">\n<li>In the next cell, enter and run the following code: <code>df2.insert(0, 'Year', 2019)<\/code>.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The code inserts a column named Year with a value of 2019 for each entry into position 0 (the first position on the left of the DataFrame).<\/p>\n<p style=\"padding-left: 80px;\">Both DataFrames now include the same columns, but the column names do not match, which will cause issues if you try to append df2 to df1. You will rename the columns for both DataFrames.<\/p>\n<ol start=\"8\">\n<li style=\"list-style-type: none;\">\n<ol start=\"8\">\n<li>Enter and run the code <code>df1.columns=['Year', 'Total collisions', 'Number of cyclists', 'Number of pedestrians', 'X', 'Y']<\/code> to rename all the columns in the df1 DataFrame.<\/li>\n<li>Repeat the previous step, editing the code to rename the columns for df2.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<details>\n<summary style=\"color: dodgerblue; padding-left: 20px;\">Click here for a hint to edit the code<\/summary>\n<p>Change df1 to df2 in the code, but keep the same column names.<\/p>\n<\/details>\n<p style=\"padding-left: 80px;\">Next, you will concatenate df1 and df2.<\/p>\n<ol start=\"8\">\n<li>In the next cell, enter the code <code>df1=pd.concat([df1, df2])<\/code> and run the cell.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">The 2019 data is appended to the 2015\u20132018 data. The df1 DataFrame now contains all the data from 2015 to 2019. You can now use df1 to create a new layer and add it to the data pane in Insights.<\/p>\n<ol start=\"11\">\n<li>Enter the code <code>%insights_return(df1)<\/code> and run the cell.<\/li>\n<\/ol>\n<p style=\"padding-left: 80px;\">A new dataset named <strong>Layer<\/strong> is added to the data pane. Your work in the Insights scripting environment is complete, so you will close it.<\/p>\n<ol start=\"12\">\n<li>In the scripting environment, click the close button, and click <strong>Yes, close<\/strong> on the warning dialog box.<\/li>\n<\/ol>\n<p>In the next section, you will rerun the models in the workbook using the newly created dataset.<\/p>\n<h1>Update the workbook model<\/h1>\n<p>In Insights, a model recording the steps in your analysis is created automatically for each page in your workbook. In this section, you will update the models on both pages using the new dataset you created so that your analysis will reflect all the available data.<\/p>\n<p>Your workbook includes two pages, and both pages will need to be updated with the <strong>Layer<\/strong> dataset. You will copy the dataset to the second page before you update the model on the current page.<\/p>\n<ol>\n<li>In the data pane, select <strong>Layer<\/strong> and drag it onto the <strong>Collisions by route type<\/strong> page.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287412,"id":1287412,"title":"7_DragToTab","filename":"7_DragToTab.png","filesize":40859,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/7_dragtotab","alt":"Drag the layer to the second tab","author":"6771","description":"","caption":"","name":"7_dragtotab","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:09:13","modified":"2021-07-08 11:09:38","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":600,"height":527,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","medium-width":297,"medium-height":261,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","medium_large-width":600,"medium_large-height":527,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","large-width":600,"large-height":527,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","1536x1536-width":600,"1536x1536-height":527,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","2048x2048-width":600,"2048x2048-height":527,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab-529x465.png","card_image-width":529,"card_image-height":465,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/7_DragToTab.png","wide_image-width":600,"wide_image-height":527}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px;\"><strong>Layer <\/strong>is added to the data pane on the <strong>Collisions by route type <\/strong>page.<\/p>\n<ol start=\"2\">\n<li>Click <strong>Collisions by ward<\/strong> to return to the first page.<\/li>\n<li>On the workbook toolbar, click the <strong>Analysis view<\/strong> button.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287422,"id":1287422,"title":"8_AnalysisView","filename":"8_AnalysisView.png","filesize":1258,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/8_analysisview","alt":"Switch to the Analysis view","author":"6771","description":"","caption":"","name":"8_analysisview","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:10:19","modified":"2021-07-08 11:10:43","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":282,"height":49,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView-213x49.png","thumbnail-width":213,"thumbnail-height":49,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","medium-width":282,"medium-height":49,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","medium_large-width":282,"medium_large-height":49,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","large-width":282,"large-height":49,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","1536x1536-width":282,"1536x1536-height":49,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","2048x2048-width":282,"2048x2048-height":49,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","card_image-width":282,"card_image-height":49,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/8_AnalysisView.png","wide_image-width":282,"wide_image-height":49}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px;\">The model in the analysis view shows the input datasets, followed by the steps in the analytical workflow and the resultant cards. You will update the input collision dataset.<\/p>\n<ol start=\"4\">\n<li>For the input dataset labeled <strong>Collisions<\/strong>, click <strong>Update<\/strong>.<\/li>\n<li>For <strong>Choose a dataset<\/strong>, expand the menu and choose <strong>Layer<\/strong>.<\/li>\n<li>For <strong>Replace fields<\/strong>, review each set of fields and verify that <strong>X<\/strong>, <strong>Y<\/strong>, and <strong>Number of cyclists<\/strong> are chosen as the replacement fields.<\/li>\n<li>Click <strong>Update<\/strong>.<\/li>\n<li>Click the <strong>Page view <\/strong>button to return to the cards.<\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1287432,"id":1287432,"title":"9_PageView","filename":"9_PageView.png","filesize":1186,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/9_pageview","alt":"Switch to Page view","author":"6771","description":"","caption":"","name":"9_pageview","status":"inherit","uploaded_to":1276772,"date":"2021-07-08 11:11:23","modified":"2021-07-08 11:11:32","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":277,"height":49,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView-213x49.png","thumbnail-width":213,"thumbnail-height":49,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","medium-width":277,"medium-height":49,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","medium_large-width":277,"medium_large-height":49,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","large-width":277,"large-height":49,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","1536x1536-width":277,"1536x1536-height":49,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","2048x2048-width":277,"2048x2048-height":49,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","card_image-width":277,"card_image-height":49,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/9_PageView.png","wide_image-width":277,"wide_image-height":49}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<p style=\"padding-left: 80px;\">The map and combo chart are updated with the new dataset. The two Traffic_Collision_by_Location datasets are no longer being used, so they can be removed from the workbook.<\/p>\n<ol start=\"9\">\n<li>For the first Collisions dataset, click the <strong>Dataset options <\/strong>button, and click <strong>Remove.<\/strong><\/li>\n<\/ol>\n"},{"acf_fc_layout":"image","image":{"ID":1782602,"id":1782602,"title":"10_RemoveDataset","filename":"10_RemoveDataset-1.png","filesize":15519,"url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","link":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\/10_removedataset-2","alt":"Remove datasets","author":"6771","description":"","caption":"","name":"10_removedataset-2","status":"inherit","uploaded_to":1276772,"date":"2022-11-29 13:14:58","modified":"2022-11-29 13:15:20","menu_order":0,"mime_type":"image\/png","type":"image","subtype":"png","icon":"https:\/\/www.esri.com\/arcgis-blog\/wp-includes\/images\/media\/default.png","width":530,"height":250,"sizes":{"thumbnail":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1-213x200.png","thumbnail-width":213,"thumbnail-height":200,"medium":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","medium-width":464,"medium-height":219,"medium_large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","medium_large-width":530,"medium_large-height":250,"large":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","large-width":530,"large-height":250,"1536x1536":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","1536x1536-width":530,"1536x1536-height":250,"2048x2048":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","2048x2048-width":530,"2048x2048-height":250,"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","card_image-width":530,"card_image-height":250,"wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/10_RemoveDataset-1.png","wide_image-width":530,"wide_image-height":250}},"image_position":"left-center","orientation":"horizontal","hyperlink":""},{"acf_fc_layout":"content","content":"<ol start=\"10\">\n<li>Repeat the previous step for the second Traffic_Collision_by_Location dataset. Next, you will update the model on the second page.<\/li>\n<li>Click the <strong>Collisions by route type<\/strong> tab.<\/li>\n<li>Repeat the steps to update the model. Remember to verify that the correct replacement fields are being used. Return to the <strong>Page<\/strong> view to view the updated cards.<\/li>\n<\/ol>\n<p>Your workbook is now updated to include collisions from 2019.<\/p>\n"}],"authors":[{"ID":6771,"user_firstname":"Vicki","user_lastname":"Cove","nickname":"Vicki Cove","user_nicename":"vickilynncove","display_name":"Vicki Lynn Cove","user_email":"VCove@esri.com","user_url":"","user_registered":"2018-03-02 00:18:48","user_description":"Vicki Lynn Cove is a documentation writer for Map Viewer analysis and ArcGIS Insights at Esri's Research and Development Centre in Ottawa, Canada. She has a background in biology, English literature, and GIS. In her spare time, Vicki Lynn enjoys fibre arts, playing her guitar, and the outdoors.","user_avatar":"<img data-del=\"avatar\" src='https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/VickiC-213x200.jpg' class='avatar pp-user-avatar avatar-96 photo ' height='96' width='96'\/>"}],"related_articles":[{"ID":826531,"post_author":"6771","post_date":"2020-04-22 10:37:51","post_date_gmt":"2020-04-22 17:37:51","post_content":"","post_title":"Use the COVID-19 Hospital Impact Model for Epidemics (CHIME) application in ArcGIS Insights","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"closed","post_password":"","post_name":"use-chime-arcgis-insights","to_ping":"","pinged":"","post_modified":"2022-11-25 09:47:02","post_modified_gmt":"2022-11-25 17:47:02","post_content_filtered":"","post_parent":0,"guid":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=826531","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"},{"ID":1163122,"post_author":"203542","post_date":"2021-03-23 08:32:27","post_date_gmt":"2021-03-23 15:32:27","post_content":"","post_title":"A Primer for Python Scripting in ArcGIS Insights","post_excerpt":"","post_status":"publish","comment_status":"open","ping_status":"closed","post_password":"","post_name":"a-primer-for-python-scripting-in-insights","to_ping":"","pinged":"","post_modified":"2021-03-24 14:07:19","post_modified_gmt":"2021-03-24 21:07:19","post_content_filtered":"","post_parent":0,"guid":"https:\/\/www.esri.com\/arcgis-blog\/?post_type=blog&#038;p=1163122","menu_order":0,"post_type":"blog","post_mime_type":"","comment_count":"0","filter":"raw"}],"card_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/try-scripting-environment-card.png","wide_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/try-scripting-environment-banner.png","show_article_image":false},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.9 (Yoast SEO v25.9) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Create your first script in the Insights scripting environment<\/title>\n<meta name=\"description\" content=\"Use the Insights scripting environment to perform a data engineering workflow.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Create your first script in the Insights scripting environment\" \/>\n<meta property=\"og:description\" content=\"Use the Insights scripting environment to perform a data engineering workflow.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\" \/>\n<meta property=\"og:site_name\" content=\"ArcGIS Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/esrigis\/\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-07T20:20:55+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@ESRI\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":[\"Article\",\"BlogPosting\"],\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\"},\"author\":{\"name\":\"Vicki Lynn Cove\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/0cd06e08354db0b57055c98b400023ce\"},\"headline\":\"Create your first script in the Insights scripting environment\",\"datePublished\":\"2021-07-26T18:03:17+00:00\",\"dateModified\":\"2026-01-07T20:20:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\"},\"wordCount\":9,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"keywords\":[\"get started\",\"Learn ArcGIS\",\"learn by doing\",\"python\",\"scripting\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\",\"name\":\"Create your first script in the Insights scripting environment\",\"isPartOf\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\"},\"datePublished\":\"2021-07-26T18:03:17+00:00\",\"dateModified\":\"2026-01-07T20:20:55+00:00\",\"description\":\"Use the Insights scripting environment to perform a data engineering workflow.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.esri.com\/arcgis-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Create your first script in the Insights scripting environment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#website\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"name\":\"ArcGIS Blog\",\"description\":\"Get insider info from Esri product teams\",\"publisher\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#organization\",\"name\":\"Esri\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png\",\"width\":400,\"height\":400,\"caption\":\"Esri\"},\"image\":{\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/esrigis\/\",\"https:\/\/x.com\/ESRI\",\"https:\/\/www.linkedin.com\/company\/5311\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/0cd06e08354db0b57055c98b400023ce\",\"name\":\"Vicki Lynn Cove\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/VickiC-213x200.jpg\",\"contentUrl\":\"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/VickiC-213x200.jpg\",\"caption\":\"Vicki Lynn Cove\"},\"description\":\"Vicki Lynn Cove is a documentation writer for Map Viewer analysis and ArcGIS Insights at Esri's Research and Development Centre in Ottawa, Canada. She has a background in biology, English literature, and GIS. In her spare time, Vicki Lynn enjoys fibre arts, playing her guitar, and the outdoors.\",\"url\":\"https:\/\/www.esri.com\/arcgis-blog\/author\/vickilynncove\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Create your first script in the Insights scripting environment","description":"Use the Insights scripting environment to perform a data engineering workflow.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights","og_locale":"en_US","og_type":"article","og_title":"Create your first script in the Insights scripting environment","og_description":"Use the Insights scripting environment to perform a data engineering workflow.","og_url":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights","og_site_name":"ArcGIS Blog","article_publisher":"https:\/\/www.facebook.com\/esrigis\/","article_modified_time":"2026-01-07T20:20:55+00:00","twitter_card":"summary_large_image","twitter_site":"@ESRI","twitter_misc":{"Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["Article","BlogPosting"],"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#article","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights"},"author":{"name":"Vicki Lynn Cove","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/0cd06e08354db0b57055c98b400023ce"},"headline":"Create your first script in the Insights scripting environment","datePublished":"2021-07-26T18:03:17+00:00","dateModified":"2026-01-07T20:20:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights"},"wordCount":9,"commentCount":0,"publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"keywords":["get started","Learn ArcGIS","learn by doing","python","scripting"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights","url":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights","name":"Create your first script in the Insights scripting environment","isPartOf":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#website"},"datePublished":"2021-07-26T18:03:17+00:00","dateModified":"2026-01-07T20:20:55+00:00","description":"Use the Insights scripting environment to perform a data engineering workflow.","breadcrumb":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.esri.com\/arcgis-blog\/products\/insights\/analytics\/create-your-first-script-in-insights#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.esri.com\/arcgis-blog\/"},{"@type":"ListItem","position":2,"name":"Create your first script in the Insights scripting environment"}]},{"@type":"WebSite","@id":"https:\/\/www.esri.com\/arcgis-blog\/#website","url":"https:\/\/www.esri.com\/arcgis-blog\/","name":"ArcGIS Blog","description":"Get insider info from Esri product teams","publisher":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.esri.com\/arcgis-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.esri.com\/arcgis-blog\/#organization","name":"Esri","url":"https:\/\/www.esri.com\/arcgis-blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2018\/04\/Esri.png","width":400,"height":400,"caption":"Esri"},"image":{"@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/esrigis\/","https:\/\/x.com\/ESRI","https:\/\/www.linkedin.com\/company\/5311\/"]},{"@type":"Person","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/0cd06e08354db0b57055c98b400023ce","name":"Vicki Lynn Cove","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.esri.com\/arcgis-blog\/#\/schema\/person\/image\/","url":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/VickiC-213x200.jpg","contentUrl":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2020\/04\/VickiC-213x200.jpg","caption":"Vicki Lynn Cove"},"description":"Vicki Lynn Cove is a documentation writer for Map Viewer analysis and ArcGIS Insights at Esri's Research and Development Centre in Ottawa, Canada. She has a background in biology, English literature, and GIS. In her spare time, Vicki Lynn enjoys fibre arts, playing her guitar, and the outdoors.","url":"https:\/\/www.esri.com\/arcgis-blog\/author\/vickilynncove"}]}},"text_date":"July 26, 2021","author_name":"Vicki Lynn Cove","author_page":"https:\/\/www.esri.com\/arcgis-blog\/author\/vickilynncove","custom_image":"https:\/\/www.esri.com\/arcgis-blog\/app\/uploads\/2021\/07\/try-scripting-environment-banner.png","primary_product":"ArcGIS Insights","tag_data":[{"term_id":101302,"name":"get started","slug":"get-started","term_group":0,"term_taxonomy_id":101302,"taxonomy":"post_tag","description":"","parent":0,"count":16,"filter":"raw"},{"term_id":25071,"name":"Learn ArcGIS","slug":"learn-arcgis","term_group":0,"term_taxonomy_id":25071,"taxonomy":"post_tag","description":"","parent":0,"count":49,"filter":"raw"},{"term_id":100192,"name":"learn by doing","slug":"learn-by-doing","term_group":0,"term_taxonomy_id":100192,"taxonomy":"post_tag","description":"","parent":0,"count":28,"filter":"raw"},{"term_id":24341,"name":"python","slug":"python","term_group":0,"term_taxonomy_id":24341,"taxonomy":"post_tag","description":"","parent":0,"count":171,"filter":"raw"},{"term_id":24351,"name":"scripting","slug":"scripting","term_group":0,"term_taxonomy_id":24351,"taxonomy":"post_tag","description":"","parent":0,"count":15,"filter":"raw"}],"category_data":[{"term_id":23341,"name":"Analytics","slug":"analytics","term_group":0,"term_taxonomy_id":23341,"taxonomy":"category","description":"","parent":0,"count":1328,"filter":"raw"}],"product_data":[{"term_id":36801,"name":"ArcGIS Insights","slug":"insights","term_group":0,"term_taxonomy_id":36801,"taxonomy":"product","description":"","parent":36591,"count":119,"filter":"raw"}],"primary_product_link":"https:\/\/www.esri.com\/arcgis-blog\/?s=#&products=insights","_links":{"self":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1276772","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog"}],"about":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/types\/blog"}],"author":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/users\/6771"}],"replies":[{"embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/comments?post=1276772"}],"version-history":[{"count":0,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/blog\/1276772\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/media?parent=1276772"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/categories?post=1276772"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/tags?post=1276772"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/industry?post=1276772"},{"taxonomy":"product","embeddable":true,"href":"https:\/\/www.esri.com\/arcgis-blog\/wp-json\/wp\/v2\/product?post=1276772"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}