Select to view content in your preferred language

Installing d-tale so you can use it in ArcPro 2.5

657
0
03-13-2020 09:42 AM
DuncanHornby
MVP Notable Contributor
1 0 657

Not being a regular user of pandas/numpy I find using such libraries difficult as I cannot visualise what I'm working with... call me old skool...

I recently came across dtale a rather cool python module that displays the data and allows you to manipulate it as if it was a spreadsheet. It also has a set of rather impressive methods for charting your data.

I immediately thought it would be great to use this inside ArcPro, using the notebook capability built right into ArcPro 2.5!

  1. If you have not already done so you need to upgrade to ArcPro 2.5 as this version supports notebooks.
  2. First of all you need to clone your environment, I talk you through this process on this blog page whilst setting up spyder to work with ArcPro.
  3. Cloning creates a copy with all it's dependencies in a less than obvious place and it is here you need to install d-tale. So having cloned the environment fire up the Windows command line and make sure you open it in Administrator mode:
  4. Type
    cd C:\Users\XXX\AppData\Local\ESRI\conda\envs\YYY‍

    where XXX is your user name and YYY is the cloned environment folder name

  5. Type
    cd Scripts‍

  6. Finally in the Scripts folder, type
    pip install --upgrade dtale‍

This will install d-tale into the cloned environment and will be accessible within ArcPro next time you open it.

So here is some sample code I then type into notebook in ArcPro, it takes a layer loaded in the map and creates a dataframe from 2 numeric fields, when you execute `d` a URL pops up and you click on it to see your data as a spreadsheet

import dtale
import pandas as pd
import arcpy
np = arcpy.da.FeatureClassToNumPyArray("EA_Sample_2020",["LOC_NO","Z020_LOC_T"])
df = pd.DataFrame(np)
d = dtale.show(df)
d

So in the window I create a new field called acs and its the SUM of the previous two fields

To get this new an improved data back into a pandas data frame you can type the following code into notebook then do something with it.

df2 = d.data.copy()
df2.head()
About the Author
GIS Desktop Developer I have specialised in river network analysis and mapping but have worked on a wide variety of projects. I am often found at the bottom of a cave!